Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest-bdd steps only support fixture using @pytest.fixture, but do not support fixture generated by pytest_generate_tests function #620

Open
leehin opened this issue Jun 12, 2023 · 0 comments

Comments

@leehin
Copy link

leehin commented Jun 12, 2023

@given("test generated fixture")
def test_generated_fixture(normal_fixture, generated_fixture):
print(fixture)
print(generated_fixture)
return 1

@pytest.fixture
def normal_fixture():
return 1

defined pytest_generated_tests in conftest.py

def pytest_generate_tests(metafunc):
if "generated_fixture" in metafunc.fixturenames:
metafunc.parametrize("generated_fixture", [1, 2, 3])

will result in error
E fixture 'generated_fixture' not found

LucHermitte pushed a commit to CNES/S1Tiling that referenced this issue Jul 19, 2024
`pytest_generate_tests` doesn't work to expose fixtures to pytest-bdd

Hence this dirty workaround. `pytest_generate_tests` sets the global
`the_baseline` that is returned then by this fixture...
~> pytest-dev/pytest-bdd#620
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant