You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pytest has special mechanism to skip modules described here.
But when applying this to conftest.py (or __init__.py), this call skip entire package, not only that module. And this happened even with allow_module_level=False. For example:
# content of tests/test_package_A/confest.pyimportsysimportpytestifsys.version_info< (3, 11):
pytest.skip("Python>=3.11 is required. ", allow_module_level=False)
Pytest and operating system versions
pytest 8.2.1 MacOS Monterey 12.3.1 (21E258)
Expecting behaviour
1- Do not allow using pytest.skip(allow_module_level=False) in conftest.py (or __init__.py). The same, as It's not allowed for test modules. So, expected error message might be the same:
Using pytest.skip outside of a test will skip the entire module. If that's your intention, pass allow_module_level=True
2- And even more, I would suggest that another flag should be set explicitly to skip entire directory/package. For example:
pytest.skip("Python>=3.11 is required. ", allow_package_level=True) # package level flag specified here
The text was updated successfully, but these errors were encountered:
Problem description
Pytest has special mechanism to skip modules described here.
But when applying this to
conftest.py
(or__init__.py
), this call skip entire package, not only that module. And this happened even withallow_module_level=False
. For example:Pytest and operating system versions
pytest 8.2.1
MacOS Monterey 12.3.1 (21E258)
Expecting behaviour
1- Do not allow using
pytest.skip(allow_module_level=False)
inconftest.py
(or__init__.py
). The same, as It's not allowed for test modules. So, expected error message might be the same:2- And even more, I would suggest that another flag should be set explicitly to skip entire directory/package. For example:
The text was updated successfully, but these errors were encountered: