Repository navigation
[Test] Make the Hydra config tests pass on pytest 9.2 - #4640
Open
peterdsharpe wants to merge 1 commit into
Open
peterdsharpe wants to merge 1 commit into
peterdsharpe wants to merge 1 commit into
Conversation
pytest 9.2 deprecates module-scoped fixtures defined as instance methods. test_configs.py turns every warning into an error, so that warning from init_hydra made all 21 TestHydraParsing tests error at setup on Python 3.10 to 3.13. Make the fixture a classmethod, as pytest suggests. It does not use self.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4640
Note: Links to docs will display an error until the docs builds have been completed.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since pytest 9.2.0 came out on 2026-10-27, all 21
TestHydraParsingtests intest/test_configs.pyerror at setup on Python 3.10 to 3.13. That fails the CPUbulkjobs on main (tests-cpu (3.10, bulk)) and on every open PR. Python 3.14 passes only because the class is skipped there.pytest 9.2 deprecates module-scoped fixtures defined as instance methods, with a
PytestRemovedIn10Warning.init_hydrais one of them, andtest_configs.pyturns every warning into an error (pytestmark = pytest.mark.filterwarnings("error")). This PR makesinit_hydraa classmethod, as the warning suggests. The fixture does not useself.Checked locally on CPU with Python 3.12, tensordict main and
BATCHED_PIPE_TIMEOUT=60, as in CI. With pytest 9.2.0, main gives 21 errors at setup and this branch passes all 21 tests. With pytest 9.1.1, this branch passes all 21 too.Other fixtures in the test suite are written the same way. They only warn, because their files do not turn warnings into errors.
Motivation and Context
No issue raised: the change only touches one test fixture, and the CI logs show the failures.
Types of changes
Checklist