mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fail redis and mongo tests if incorrect URI
If incorrect URIs provided to "--redis" and/or "--mongo" options
tests should fail with ERRORs instead of skipping.
Otherwise the next scenario is possible:
1) developer breaks RedisStorage and/or MongoStorage code
2) tests are run with incorrect redis and/or mongo URIs
provided by "--redis" and "--mongo" options.
For example, wrong port specified.
3) tests pass because skipping doesn't fail tests run
4) developer or reviewer doesn't notice
that redis and/or mongo tests were skipped
5) broken code gets in codebase
This commit is contained in:
parent
15106f62df
commit
8837f1767c
1 changed files with 2 additions and 2 deletions
|
|
@ -54,7 +54,7 @@ async def redis_storage(redis_server):
|
|||
try:
|
||||
await storage.redis.info()
|
||||
except ConnectionError as e:
|
||||
pytest.skip(str(e))
|
||||
pytest.fail(str(e))
|
||||
try:
|
||||
yield storage
|
||||
finally:
|
||||
|
|
@ -85,7 +85,7 @@ async def mongo_storage(mongo_server):
|
|||
try:
|
||||
await storage._client.server_info()
|
||||
except PyMongoError as e:
|
||||
pytest.skip(str(e))
|
||||
pytest.fail(str(e))
|
||||
else:
|
||||
yield storage
|
||||
await storage._client.drop_database(storage._database)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue