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

Provide a parameter to guarantee fixture uniqueness in @fixture #18

Open
smarie opened this issue Dec 21, 2018 · 1 comment
Open

Provide a parameter to guarantee fixture uniqueness in @fixture #18

smarie opened this issue Dec 21, 2018 · 1 comment

Comments

@smarie
Copy link
Owner

smarie commented Dec 21, 2018

session-scoped fixtures are not guaranteed to be unique by session, and module-scoped fixtures are not guaranteed to be unique for an unique parameter, in pytest. See pytest-dev/pytest#2846

We could at least try to provide a workaround in the @cases_fixture decorator, such as ensure_unique=True.

Note that pytest-dev/pytest#3393 will not solve the problem because if users have two parametrized session-scoped fixtures, one of them will end-up being setup/teardown twice for each of its parameters.

@smarie smarie added the enhancement New feature or request label Dec 21, 2018
@smarie smarie changed the title Provide a uniqueness @cases_fixture Provide a parameter to guarantee fixture uniqueness in @cases_fixture Dec 21, 2018
@smarie smarie changed the title Provide a parameter to guarantee fixture uniqueness in @cases_fixture Provide a parameter to guarantee fixture uniqueness in @pytest_fixture_plus Jan 7, 2019
@smarie
Copy link
Owner Author

smarie commented Jan 7, 2019

Updated this issue since @cases_fixture is now deprecated and equivalent to @fixture + @parametrize_with_cases

@smarie smarie changed the title Provide a parameter to guarantee fixture uniqueness in @pytest_fixture_plus Provide a parameter to guarantee fixture uniqueness in @fixture Jul 9, 2020
@smarie smarie added pytest-goodies new_feature and removed enhancement New feature or request labels Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant