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 fixture scope #415

Open
last-partizan opened this issue Aug 6, 2020 · 3 comments
Open

pytest fixture scope #415

last-partizan opened this issue Aug 6, 2020 · 3 comments
Labels

Comments

@last-partizan
Copy link

@pytest.fixture(name="override_config")

By default pytest fixture has scope="function", so it can not be used with any scope, as mentioned in docs.

@TamoshaytisV
Copy link
Contributor

TamoshaytisV commented Nov 14, 2021

@last-partizan unfortunately, the global fixture can have only one scope. So no way to make it universal for any scope.
Luckily, a user is still able to override the fixture in the project's conftest.py or any test file like

@pytest.fixture(scope='module')
def override_config(override_config):  # give same name for the custom fixture 
    with override_config(API_URL="/awesome/url/"):
        yield

So i think this issue is more about mentioning that in the documentation rather than fixing fixture.

@last-partizan
Copy link
Author

Yes, it's about mentioning this in documentation.

@camilonova
Copy link
Member

Can anyone help us with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants