From fb46bde2d9b9b8797cf3036c4f94d126d0b0d720 Mon Sep 17 00:00:00 2001 From: onstabb Date: Fri, 29 Sep 2023 14:09:32 +0200 Subject: [PATCH] - Fixed workflow v3 --- .github/workflows/tests.yml | 4 +++- pytest.ini | 2 ++ tests/conftest.py | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 pytest.ini diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84f9f01..bf88977 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,4 +37,6 @@ jobs: run: cd tests - name: Run Tests - run: pytest . + run: | + pip install pytest pytest-cov + pytest . --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..d754964 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +pythonpath = src/ tests/ diff --git a/tests/conftest.py b/tests/conftest.py index cd0610f..cc2c10d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -46,7 +46,7 @@ def factory_random(seed): @pytest.fixture(scope="session") -def file_conf(): +def image_file_storage_conf(): storage_dir = os.path.join(DATA_DIR, "Image Storage") if not os.path.exists(storage_dir): os.mkdir(storage_dir) @@ -71,7 +71,7 @@ def city_db(): @pytest.fixture(scope="session") def db_mock_config(): - db = init_db(host=config.DB_HOST, db=config.DB_NAME, mongo_client_class=MongoClient) + db = init_db(host=config.DB_HOST, db=config.DB_NAME, mongo_client_class=MongoClient, ) yield db close_db() @@ -86,7 +86,7 @@ def db_config(factory_random): @pytest.fixture() -def client(db_config, scheduler, city_db, file_conf): +def client(db_config, scheduler, city_db, image_file_storage_conf): auth_config.SMS_SERVICE_DISABLED = True client = TestClient(app=app) yield client