tests: use pytest-lazy-fixtureS instead of pytest-lazy-fixture

This commit is contained in:
Éloi Rivard 2024-04-16 18:33:58 +02:00
parent 1080952a75
commit ce890ca0ad
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184
3 changed files with 14 additions and 12 deletions

16
poetry.lock generated
View file

@ -1678,18 +1678,18 @@ files = [
Werkzeug = ">=2.0.0" Werkzeug = ">=2.0.0"
[[package]] [[package]]
name = "pytest-lazy-fixture" name = "pytest-lazy-fixtures"
version = "0.6.3" version = "1.0.7"
description = "It helps to use fixtures in pytest.mark.parametrize" description = "Allows you to use fixtures in @pytest.mark.parametrize."
optional = false optional = false
python-versions = "*" python-versions = ">=3.8,<4.0"
files = [ files = [
{file = "pytest-lazy-fixture-0.6.3.tar.gz", hash = "sha256:0e7d0c7f74ba33e6e80905e9bfd81f9d15ef9a790de97993e34213deb5ad10ac"}, {file = "pytest_lazy_fixtures-1.0.7-py3-none-any.whl", hash = "sha256:71428385b166cdb0fa3f2a3c72b5a5f95fa58f977816877b9b9c1e857143e194"},
{file = "pytest_lazy_fixture-0.6.3-py3-none-any.whl", hash = "sha256:e0b379f38299ff27a653f03eaa69b08a6fd4484e46fd1c9907d984b9f9daeda6"}, {file = "pytest_lazy_fixtures-1.0.7.tar.gz", hash = "sha256:87ef7424dc0229ff9cb72d482f49b7806535c3500641f612c13ddf243c9adacb"},
] ]
[package.dependencies] [package.dependencies]
pytest = ">=3.2.5" pytest = ">=7"
[[package]] [[package]]
name = "pytest-smtpd" name = "pytest-smtpd"
@ -2531,4 +2531,4 @@ sql = ["passlib", "sqlalchemy", "sqlalchemy-json", "sqlalchemy-utils"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.8" python-versions = "^3.8"
content-hash = "0aebc0acd9e89b74feef1d6730f2c9b45035480d5076b0017d8bdf8f2c32fe74" content-hash = "20078ca5ed86bb52479755af76d47881976d1d4e529053c5ea10bad07e4816a2"

View file

@ -88,11 +88,11 @@ pyquery = "*"
pytest = "^7.0.0" pytest = "^7.0.0"
pytest-coverage = "*" pytest-coverage = "*"
pytest-httpserver = "*" pytest-httpserver = "*"
pytest-lazy-fixture = "==0.6.3"
pytest-smtpd = "^0.1.0" pytest-smtpd = "^0.1.0"
pytest-xdist = "^3.3.1" pytest-xdist = "^3.3.1"
slapd = "*" slapd = "*"
toml = "^0.10.0" toml = "^0.10.0"
pytest-lazy-fixtures = "^1.0.7"
[tool.poetry.group.demo] [tool.poetry.group.demo]
optional = true optional = true

View file

@ -5,7 +5,6 @@ from babel.messages.frontend import compile_catalog
from flask_webtest import TestApp from flask_webtest import TestApp
from jinja2 import FileSystemBytecodeCache from jinja2 import FileSystemBytecodeCache
from jinja2 import StrictUndefined from jinja2 import StrictUndefined
from pytest_lazyfixture import lazy_fixture
from werkzeug.security import gen_salt from werkzeug.security import gen_salt
from canaille import create_app from canaille import create_app
@ -48,12 +47,15 @@ def pytest_generate_tests(metafunc):
if backend not in backends: # pragma: no cover if backend not in backends: # pragma: no cover
pytest.skip() pytest.skip()
elif "backend" in metafunc.fixturenames: elif "backend" in metafunc.fixturenames:
metafunc.parametrize("backend", [lazy_fixture(f"{backend}_backend")]) metafunc.parametrize(
"backend", [pytest.lazy_fixtures(f"{backend}_backend")]
)
return return
elif "backend" in metafunc.fixturenames: elif "backend" in metafunc.fixturenames:
metafunc.parametrize( metafunc.parametrize(
"backend", [lazy_fixture(f"{backend}_backend") for backend in backends] "backend",
[pytest.lazy_fixtures(f"{backend}_backend") for backend in backends],
) )