Skip to content

[Test] Make the Hydra config tests pass on pytest 9.2 - #4640

Open
peterdsharpe wants to merge 1 commit into
pytorch:mainfrom
peterdsharpe:hydra-config-tests-pytest-9-2
Open

peterdsharpe wants to merge 1 commit into
pytorch:mainfrom
peterdsharpe:hydra-config-tests-pytest-9-2

Conversation

@peterdsharpe

Copy link
Copy Markdown
Contributor

Description

Since pytest 9.2.0 came out on 2026-10-27, all 21 TestHydraParsing tests in test/test_configs.py error at setup on Python 3.10 to 3.13. That fails the CPU bulk jobs 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_hydra is one of them, and test_configs.py turns every warning into an error (pytestmark = pytest.mark.filterwarnings("error")). This PR makes init_hydra a classmethod, as the warning suggests. The fixture does not use self.

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

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.

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.
@pytorch-bot

pytorch-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🔗 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.

⚠️ 16 Awaiting Approval

As of commit 9c541a2 with merge base fd8b9d4 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 29, 2026
@github-actions github-actions Bot added the Tests Incomplete or broken unit tests label Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Tests Incomplete or broken unit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant