diff options
| author | Ján Jančár | 2023-04-25 11:58:55 +0200 |
|---|---|---|
| committer | GitHub | 2023-04-25 11:58:55 +0200 |
| commit | e8bb30b3385a04fc0f81497da53b88cce6d14117 (patch) | |
| tree | fc571bb7077c81786f969493c1d9d651efe66a8b | |
| parent | 8b0600e0e057e7afcf8529c96a4fb5961e18e8a0 (diff) | |
| parent | c7e97a58ae1c5f9a016cb30b16ecc0bb122e15ce (diff) | |
| download | sec-certs-e8bb30b3385a04fc0f81497da53b88cce6d14117.tar.gz sec-certs-e8bb30b3385a04fc0f81497da53b88cce6d14117.tar.zst sec-certs-e8bb30b3385a04fc0f81497da53b88cce6d14117.zip | |
Merge pull request #330 from crocs-muni/fix/yield-paths
Fix path fixtures yielding.
| -rw-r--r-- | tests/cc/conftest.py | 5 | ||||
| -rw-r--r-- | tests/cc/test_cc_analysis.py | 5 | ||||
| -rw-r--r-- | tests/cc/test_cc_certificate.py | 5 | ||||
| -rw-r--r-- | tests/cc/test_cc_maintenance_updates.py | 5 | ||||
| -rw-r--r-- | tests/conftest.py | 9 | ||||
| -rw-r--r-- | tests/fips/test_fips_certificate.py | 5 | ||||
| -rw-r--r-- | tests/fips/test_fips_dataset.py | 5 | ||||
| -rw-r--r-- | tests/fips/test_fips_iut.py | 5 | ||||
| -rw-r--r-- | tests/fips/test_fips_mip.py | 5 | ||||
| -rw-r--r-- | tests/test_config.py | 2 |
10 files changed, 30 insertions, 21 deletions
diff --git a/tests/cc/conftest.py b/tests/cc/conftest.py index e2c75de4..ad60037c 100644 --- a/tests/cc/conftest.py +++ b/tests/cc/conftest.py @@ -1,6 +1,7 @@ from datetime import date from importlib import resources from pathlib import Path +from typing import Generator import pytest import tests.data.cc.dataset @@ -11,9 +12,9 @@ from sec_certs.sample.protection_profile import ProtectionProfile @pytest.fixture(scope="module") -def data_dir() -> Path: +def data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.cc.dataset, "") as path: - return path + yield path @pytest.fixture diff --git a/tests/cc/test_cc_analysis.py b/tests/cc/test_cc_analysis.py index d0618266..0b0edf7e 100644 --- a/tests/cc/test_cc_analysis.py +++ b/tests/cc/test_cc_analysis.py @@ -3,6 +3,7 @@ from __future__ import annotations import shutil from importlib import resources from pathlib import Path +from typing import Generator import pytest import tests.data.cc.analysis @@ -18,9 +19,9 @@ from sec_certs.sample.sar import SAR @pytest.fixture(scope="module") -def analysis_data_dir() -> Path: +def analysis_data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.cc.analysis, "") as path: - return path + yield path @pytest.fixture(scope="module") diff --git a/tests/cc/test_cc_certificate.py b/tests/cc/test_cc_certificate.py index 10dfa248..772d859c 100644 --- a/tests/cc/test_cc_certificate.py +++ b/tests/cc/test_cc_certificate.py @@ -2,6 +2,7 @@ import json import shutil from importlib import resources from pathlib import Path +from typing import Generator import pytest import tests.data.cc.analysis @@ -12,9 +13,9 @@ from sec_certs.sample import CCCertificate @pytest.fixture(scope="module") -def data_dir() -> Path: +def data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.cc.certificate, "") as path: - return path + yield path @pytest.fixture(scope="module") diff --git a/tests/cc/test_cc_maintenance_updates.py b/tests/cc/test_cc_maintenance_updates.py index a017df8b..c89c9164 100644 --- a/tests/cc/test_cc_maintenance_updates.py +++ b/tests/cc/test_cc_maintenance_updates.py @@ -1,6 +1,7 @@ import json from importlib import resources from pathlib import Path +from typing import Generator import pytest import tests.data.cc.dataset @@ -10,9 +11,9 @@ from sec_certs.sample.cc_maintenance_update import CCMaintenanceUpdate @pytest.fixture(scope="module") -def data_dir() -> Path: +def data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.cc.dataset, "") as path: - return path + yield path @pytest.fixture diff --git a/tests/conftest.py b/tests/conftest.py index bb35dad1..1d8e2a09 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ import json from importlib import resources from pathlib import Path +from typing import Generator import pytest @@ -16,9 +17,9 @@ def load_test_config(): @pytest.fixture(scope="module") -def cve_dataset_path() -> Path: +def cve_dataset_path() -> Generator[Path, None, None]: with resources.path(tests.data.common, "cve_dataset.json") as cve_dataset_path: - return cve_dataset_path + yield cve_dataset_path @pytest.fixture(scope="module") @@ -36,9 +37,9 @@ def cve_dataset(cve_dataset_path: Path, cpe_match_feed: dict) -> CVEDataset: @pytest.fixture(scope="module") -def cpe_dataset_path() -> Path: +def cpe_dataset_path() -> Generator[Path, None, None]: with resources.path(tests.data.common, "cpe_dataset.json") as cpe_dataset_path: - return cpe_dataset_path + yield cpe_dataset_path @pytest.fixture(scope="module") diff --git a/tests/fips/test_fips_certificate.py b/tests/fips/test_fips_certificate.py index 99b1d9b7..498c2328 100644 --- a/tests/fips/test_fips_certificate.py +++ b/tests/fips/test_fips_certificate.py @@ -4,6 +4,7 @@ import json import shutil from importlib import resources from pathlib import Path +from typing import Generator import pytest import tests.data.fips.certificate @@ -14,9 +15,9 @@ from sec_certs.sample.fips import FIPSCertificate @pytest.fixture(scope="module") -def data_dir() -> Path: +def data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.fips.certificate, "") as path: - return path + yield path @pytest.fixture diff --git a/tests/fips/test_fips_dataset.py b/tests/fips/test_fips_dataset.py index ed7808be..43c4fdbd 100644 --- a/tests/fips/test_fips_dataset.py +++ b/tests/fips/test_fips_dataset.py @@ -5,6 +5,7 @@ import shutil from importlib import resources from pathlib import Path from tempfile import TemporaryDirectory +from typing import Generator import pytest import tests.data.fips.dataset @@ -15,9 +16,9 @@ from sec_certs.sample.fips import FIPSCertificate @pytest.fixture(scope="module") -def data_dir() -> Path: +def data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.fips.dataset, "") as path: - return path + yield path def test_dataset_to_json(toy_dataset: FIPSDataset, data_dir: Path, tmp_path: Path): diff --git a/tests/fips/test_fips_iut.py b/tests/fips/test_fips_iut.py index cf1434b0..cef0b758 100644 --- a/tests/fips/test_fips_iut.py +++ b/tests/fips/test_fips_iut.py @@ -3,6 +3,7 @@ from __future__ import annotations import datetime from importlib import resources from pathlib import Path +from typing import Generator import pytest import tests.data.fips.iut @@ -14,9 +15,9 @@ from sec_certs.sample.fips_iut import IUTEntry, IUTSnapshot @pytest.fixture(scope="module") -def data_dir() -> Path: +def data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.fips.iut, "") as path: - return path + yield path @pytest.fixture(scope="module") diff --git a/tests/fips/test_fips_mip.py b/tests/fips/test_fips_mip.py index 7fb473c2..db3e7d8c 100644 --- a/tests/fips/test_fips_mip.py +++ b/tests/fips/test_fips_mip.py @@ -3,6 +3,7 @@ from __future__ import annotations import datetime from importlib import resources from pathlib import Path +from typing import Generator import pytest import tests.data.fips.mip @@ -14,9 +15,9 @@ from sec_certs.sample.fips_mip import MIPEntry, MIPSnapshot, MIPStatus @pytest.fixture(scope="module") -def data_dir() -> Path: +def data_dir() -> Generator[Path, None, None]: with resources.path(tests.data.fips.mip, "") as path: - return path + yield path @pytest.fixture(scope="module") diff --git a/tests/test_config.py b/tests/test_config.py index 7c20dec1..a9099327 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -9,7 +9,7 @@ import pytest import yaml import sec_certs.configuration as config_module -import tests.data +import tests.data.common @pytest.fixture(autouse=True) |
