diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2023-06-14 18:20:09 +0100 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2023-06-14 18:20:09 +0100 |
commit | c183bd8749a19477390f8cb77efe5f6d223f0905 (patch) | |
tree | 4e821e9cb07be9a86bf2d442acb3ea6740ba5a99 /test/conftest.py | |
parent | c6d05191a069ac150cc8eb2bece75cf79c0a465a (diff) | |
download | unit-c183bd8749a19477390f8cb77efe5f6d223f0905.tar.gz unit-c183bd8749a19477390f8cb77efe5f6d223f0905.tar.bz2 |
Tests: get rid of classes in test files.
Class usage came from the unittest framework and it was always redundant
after migration to the pytest. This commit removes classes from files
containing tests to make them more readable and understandable.
Diffstat (limited to 'test/conftest.py')
-rw-r--r-- | test/conftest.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/conftest.py b/test/conftest.py index 4487f059..31709d24 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -15,7 +15,7 @@ from multiprocessing import Process import pytest from unit.check.discover_available import discover_available from unit.check.check_prerequisites import check_prerequisites -from unit.http import TestHTTP +from unit.http import HTTP1 from unit.log import Log from unit.log import print_log_on_assert from unit.option import option @@ -82,7 +82,7 @@ _fds_info = { 'skip': False, }, } -http = TestHTTP() +http = HTTP1() is_findmnt = check_findmnt() @@ -113,15 +113,16 @@ def pytest_configure(config): def pytest_generate_tests(metafunc): - cls = metafunc.cls + module = metafunc.module if ( - not hasattr(cls, 'application_type') - or cls.application_type == None - or cls.application_type == 'external' + not hasattr(module, 'client') + or not hasattr(module.client, 'application_type') + or module.client.application_type is None + or module.client.application_type == 'external' ): return - type = cls.application_type + app_type = module.client.application_type def generate_tests(versions): if not versions: @@ -133,7 +134,7 @@ def pytest_generate_tests(metafunc): for version in versions: option.generated_tests[ f'{metafunc.function.__name__} [{version}]' - ] = f'{type} {version}' + ] = f'{app_type} {version}' # take available module from option and generate tests for each version @@ -149,7 +150,7 @@ def pytest_generate_tests(metafunc): elif version == 'any': option.generated_tests[ metafunc.function.__name__ - ] = f'{type} {available_versions[0]}' + ] = f'{app_type} {available_versions[0]}' elif callable(version): generate_tests(list(filter(version, available_versions))) |