Skip to content

[bench] tests: drop unused original_cwd in cross-drive test#17

Merged
dburks-svg merged 1 commit into
mainfrom
bench/fix-unused-var
Jul 24, 2026
Merged

[bench] tests: drop unused original_cwd in cross-drive test#17
dburks-svg merged 1 commit into
mainfrom
bench/fix-unused-var

Conversation

@dburks-svg

Copy link
Copy Markdown
Contributor

Clears the last outstanding lint error. ruff now passes clean across the whole codebase.

test_cross_drive_valueerror_normalizes_to_cwd captured os.getcwd() into original_cwd but never called os.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 changes directory and forgets to restore it, which is a real test-pollution bug, or
  • the test never changes directory and the capture is dead.

The test immediately above this one uses the full pattern: capture, os.chdir(tmpdir), then os.chdir(original_cwd) in its finally. This one copied the capture and not the chdir, so it is the second case. Deleting is correct; the two remaining uses of original_cwd in the file are the tests that genuinely change directory.

29 tests in tests.test_hook pass. Pre-existing issue, unrelated to any change in PRs #13 through #16, which is why it was held back from each of them.

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
@dburks-svg
dburks-svg merged commit 6bd182c into main Jul 24, 2026
6 checks passed
@dburks-svg
dburks-svg deleted the bench/fix-unused-var branch July 24, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant