fix(tests): preserve config module identity in backup tests - #73272
Closed
frizikk wants to merge 1 commit into
Closed
fix(tests): preserve config module identity in backup tests#73272frizikk wants to merge 1 commit into
frizikk wants to merge 1 commit into
Conversation
Closed
6 tasks
Contributor
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.
What does this PR do?
Fixes an order-dependent test-isolation failure in the CLI suite. The pre-update-backup fixture removed
hermes_cli.configandhermes_constantsdirectly fromsys.modules. Other collected tests retained imports from the old config module, while string-based patches resolved the newly imported module, so the patched sanitizer was not called.The fixture now relies on Hermes' path/mtime-keyed config caches instead of replacing shared module objects.
Related Issue
Fixes #73144
Type of Change
Changes Made
sys.moduleseviction fromTestRunPreUpdateBackupsetup and mode configuration intests/hermes_cli/test_backup.py.HERMES_HOMEandPath.home()isolation intact.TestSanitizeEnvLines.test_migrate_reports_normalized_line_formattingwhen it runs after the backup test.How to Test
main, run:pytest \ tests/hermes_cli/test_backup.py::TestRunPreUpdateBackup::test_default_creates_quick_snapshot_only \ tests/hermes_cli/test_config.py::TestSanitizeEnvLines::test_migrate_reports_normalized_line_formatting \ -q -o 'addopts='1 passed, 1 failed: the config test captures no normalization message.2 passed.350 passed.Checklist
Code
pytest tests/ -qand all tests pass (the wider CLI suite has unrelated existing failures; targeted canonical suites pass)Documentation & Housekeeping
cli-config.yaml.exampleN/ACONTRIBUTING.md/AGENTS.mdN/AScreenshots / Logs
Focused validation: