From 8837f1767c50b3665c9e4b7df6a8c4f9228e62e9 Mon Sep 17 00:00:00 2001 From: Rishat Fayzullin Date: Thu, 13 Jun 2024 13:16:57 +0300 Subject: [PATCH] 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 --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index c8d32265..4d1f38b4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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)