Repository navigation
Description
Description
The test suite emits a PytestRemovedIn10Warning from the class-scoped install_workspace fixture in tests/test_install_script.py:
PytestRemovedIn10Warning: Class-scoped fixture defined as instance method is deprecated.
Instance attributes set in this fixture will NOT be visible to test methods,
as each test gets a new instance while the fixture runs only once per class.
Use @classmethod decorator and set attributes on cls instead.
Today this is cosmetic — the fixture only yields a value that the 17 tests consume via the fixture parameter; it never sets self. attributes that tests read, and warnings are not escalated to errors. But it is latent forward-breakage: the project pins pytest==9.1.1, and pytest 10 removes this pattern. When Renovate/Dependabot bumps pytest to 10, the fixture will error at collection and take out the entire TestInstallScriptIntegration suite.
Filing as low-priority to fix proactively before the pytest 10 bump lands.
Steps to Reproduce
- Run any test that touches
TestInstallScriptIntegration, e.g.:TEST_CONTAINER_TAG=dev uv run pytest tests/test_install_script.py -v
- Observe the
PytestRemovedIn10Warningin the warnings summary. - To confirm it will break under pytest 10, escalate it to an error:
TEST_CONTAINER_TAG=dev uv run pytest tests/test_install_script.py -W error::pytest.PytestRemovedIn10Warning
Expected Behavior
No deprecation warning; the install-script integration tests remain collectable and green under pytest 9 and 10.
Actual Behavior
PytestRemovedIn10Warning is emitted. Under a future pytest 10, the deprecated pattern is removed and collection of TestInstallScriptIntegration fails.
Environment
- OS: NixOS 26.05 (Yarara)
- pytest: 9.1.1 (pinned in
pyproject.toml) - Architecture: x86_64
Root cause
tests/test_install_script.py:32 defines a class-scoped fixture as an instance method:
class TestInstallScriptIntegration:
@pytest.fixture(scope="class")
def install_workspace(self, container_image):
...
yield workspace_pathpytest deprecated (and will remove in v10) class-scoped fixtures defined as instance methods, because each test gets a fresh instance while the fixture runs once per class — making self-based state unreliable. This is the only fixture in tests/ matching the pattern (conftest, test_integration, test_utils, test_image, test_flake_devshell are all clear).
Suggested fix
Convert install_workspace so it no longer relies on the deprecated instance-method form, while preserving the "run install.sh once per class" intent. Either:
- Make it a
@classmethod(or@staticmethod) keepingscope="class", takingcontainer_imageas a fixture arg andyield-ing as today (noself); or - Lift it to a module-level fixture (
scope="module"≈ class scope here, since only one class uses it).
Tests already consume it via the fixture parameter, so no test-method changes are needed.
Verify the fix with the warning escalated to an error:
TEST_CONTAINER_TAG=dev uv run pytest tests/test_install_script.py \
-W error::pytest.PytestRemovedIn10Warning -v --tb=shortChangelog Category
Fixed
Activity
fix(ci): make install_workspace a staticmethod fixture
fix(ci): make install_workspace a staticmethod fixture (#691) (#693)
c-vigo commentedon Jul 1, 2026
Already resolved on
dev.tests/test_install_script.pynow decoratesinstall_workspacewith@staticmethodunder@pytest.fixture(scope="class")(landed ind99765c6, fix(ci): make install_workspace a staticmethod fixture), so the class-scoped-instance-method pattern is gone and the suite is pytest-10-safe. Closing as done.