a detailed description of the bug or problem you are having
A package-level pytestmark = pytest.mark.skip(...) defined in __init__.py is no longer propagated to tests inside that package. Tests that should be skipped run and fail instead.
This is a regression introduced by PR #6197.
pytest and operating system versions
pytest 9.1.1
Python 3.11.13
Linux
minimal example if possible
from pathlib import Path
import shutil
import pytest
root = Path("/tmp/pytest_pkg_skip_test")
shutil.rmtree(root, ignore_errors=True)
package = root / "skippedpkg"
package.mkdir(parents=True)
(package / "__init__.py").write_text(
"import pytest\n"
"pytestmark = pytest.mark.skip(reason='package is disabled')\n"
)
(package / "test_skipped.py").write_text(
"def test_should_be_skipped():\n"
" assert False\n"
)
result = pytest.main(["-q", str(package)])
print("exit code:", int(result))
shutil.rmtree(root, ignore_errors=True)
Expected: 1 skipped, exit code 0
Actual: 1 failed (assert False runs because skip marker is not applied), exit code 1
a detailed description of the bug or problem you are having
A package-level
pytestmark = pytest.mark.skip(...)defined in__init__.pyis no longer propagated to tests inside that package. Tests that should be skipped run and fail instead.This is a regression introduced by PR #6197.
pytest and operating system versions
minimal example if possible
Expected:
1 skipped, exit code 0Actual:
1 failed(assert False runs because skip marker is not applied), exit code 1