[bench] tests: drop unused original_cwd in cross-drive test#17
Merged
Conversation
F841. test_cross_drive_valueerror_normalizes_to_cwd captured os.getcwd() but never changed directory, so nothing needed restoring. Copy-paste residue from the test directly above it, which does chdir into a tmpdir and legitimately restores in its finally block. Checked that neighbour before deleting: a captured cwd with no restore call can mean a missing restore rather than a dead variable, and that would have been a real test-pollution bug. Here it is genuinely dead. The two remaining uses of original_cwd in this file are the tests that actually chdir. ruff now passes clean across the whole codebase. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QFU7kbe53G7BPUZHprb9G
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.
Clears the last outstanding lint error.
ruffnow passes clean across the whole codebase.test_cross_drive_valueerror_normalizes_to_cwdcapturedos.getcwd()intooriginal_cwdbut never calledos.chdir, so nothing needed restoring and the variable was never read.Checked before deleting
A captured cwd with no corresponding restore can mean one of two things, and they need opposite fixes:
The test immediately above this one uses the full pattern: capture,
os.chdir(tmpdir), thenos.chdir(original_cwd)in itsfinally. This one copied the capture and not thechdir, so it is the second case. Deleting is correct; the two remaining uses oforiginal_cwdin the file are the tests that genuinely change directory.29 tests in
tests.test_hookpass. Pre-existing issue, unrelated to any change in PRs #13 through #16, which is why it was held back from each of them.