forked from Github-Mirrors/canaille
tests: fix backend assignation for tests
This commit is contained in:
parent
8a5dd04c87
commit
79533acc4b
1 changed files with 9 additions and 11 deletions
|
@ -40,10 +40,8 @@ def pytest_generate_tests(metafunc):
|
|||
backends &= set(metafunc.config.getoption("backend"))
|
||||
|
||||
# tests in tests.backends.BACKENDNAME should only run one backend
|
||||
if metafunc.module.__name__.startswith("tests.backends"):
|
||||
module_name_parts = metafunc.module.__name__.split(".")
|
||||
in_backend_module = len(module_name_parts) > 3
|
||||
if in_backend_module:
|
||||
if module_name_parts[0:2] == ["tests", "backends"] and len(module_name_parts) > 3:
|
||||
backend = module_name_parts[2]
|
||||
if backend not in backends: # pragma: no cover
|
||||
pytest.skip()
|
||||
|
@ -51,7 +49,7 @@ def pytest_generate_tests(metafunc):
|
|||
metafunc.parametrize("backend", [lazy_fixture(f"{backend}_backend")])
|
||||
return
|
||||
|
||||
if "backend" in metafunc.fixturenames:
|
||||
elif "backend" in metafunc.fixturenames:
|
||||
metafunc.parametrize(
|
||||
"backend", [lazy_fixture(f"{backend}_backend") for backend in backends]
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue