diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2020-12-09 16:17:46 +0000 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2020-12-09 16:17:46 +0000 |
commit | 7be62c3c213c3da1da1a45c8db16192eb0ed14d8 (patch) | |
tree | 6c44a78d9e8fb357998f887390b472497a953d35 /test/conftest.py | |
parent | 4c846ae69308983050a55f6467c2d53e78120e0b (diff) | |
download | unit-7be62c3c213c3da1da1a45c8db16192eb0ed14d8.tar.gz unit-7be62c3c213c3da1da1a45c8db16192eb0ed14d8.tar.bz2 |
Tests: TestUnit class removed.
Prerequisite checks moved to the fixture in conftest.py.
Diffstat (limited to 'test/conftest.py')
-rw-r--r-- | test/conftest.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/conftest.py b/test/conftest.py index 07d5f059..5c8da65f 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -184,6 +184,40 @@ def pytest_runtest_makereport(item, call): setattr(item, "rep_" + rep.when, rep) +@pytest.fixture(scope='class', autouse=True) +def check_prerequisites(request): + cls = request.cls + missed = [] + + # check modules + + if 'modules' in cls.prerequisites: + available_modules = list(option.available['modules'].keys()) + + for module in cls.prerequisites['modules']: + if module in available_modules: + continue + + missed.append(module) + + if missed: + pytest.skip('Unit has no ' + ', '.join(missed) + ' module(s)') + + # check features + + if 'features' in cls.prerequisites: + available_features = list(option.available['features'].keys()) + + for feature in cls.prerequisites['features']: + if feature in available_features: + continue + + missed.append(feature) + + if missed: + pytest.skip(', '.join(missed) + ' feature(s) not supported') + + @pytest.fixture(autouse=True) def run(request): unit = unit_run() |