Skip to content

Outdated doc regarding skipping test functions at module level #4206

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

Closed
keithly opened this issue Oct 19, 2018 · 1 comment
Closed

Outdated doc regarding skipping test functions at module level #4206

keithly opened this issue Oct 19, 2018 · 1 comment
Labels
type: docs documentation improvement, missing or needing clarification

Comments

@keithly
Copy link

keithly commented Oct 19, 2018

Under https://docs.pytest.org/en/latest/skipping.html#skipping-test-functions there's a snippet that demonstrates skipping at the module level.

import pytest

if not pytest.config.getoption("--custom-flag"):
    pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True)

It seems like pytest.config no longer exists or isn't accessible in this way. This doc should be updated to reflect the current way this would be achieved, or removed if it's not possible. I'm using pytest 3.9.1 but this may have changed in an earlier version.

@Zac-HD Zac-HD added the type: docs documentation improvement, missing or needing clarification label Oct 20, 2018
@nicoddemus
Copy link
Member

nicoddemus commented Oct 20, 2018

Thanks @keithly for the report!

That shows the problem with exposing pytest.config and pytest.item, they are installed at runtime and depends on the order the hooks execute. We should update the example to not use pytest.config, given that the purpose of the example is to showcase pytest.skip at module level anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs documentation improvement, missing or needing clarification
Projects
None yet
Development

No branches or pull requests

3 participants