Repository navigation
Keep the developer's own settings out of the test suite - #35
Merged
Merged
Conversation
app_state is built when diffui.server.state is imported, and it reads settings.json then, from the real ~/.config/diffui. The session fixture points _CONFIG_ROOT at a temp dir only afterwards, so the developer's theme, keybindings and display settings were what the tests started from. The fixture now reloads app_state from the temp config root, and a test checks the server starts at the defaults. Bump version to 0.11.4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xshwvphn2wQmVKLLS2G9kJ
…solation # Conflicts: # pyproject.toml
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.
Problem
app_stateis built whendiffui.server.stateis imported, andAppState.__init__readssettings.jsonat that moment, from the real~/.config/diffui. The session fixture inconftest.pypoints_CONFIG_ROOTat a temp dir only afterwards, so the suite starts from whatever the developer saved: theme, editor, font size, word wrap, rebound keys.Nothing on
mainfails from it today, but any test that depends on a display setting does. With #33 (All lines) for example, a developer who leaves All lines on gets two TUI failures, because the diff opens with the whole file instead of the hunks.Fix
The session fixture calls
app_state.__init__()right after patching_CONFIG_ROOT, so the settings are reloaded from the empty temp root. No production code changes.Tests
test_settings_start_at_the_defaults_whatever_the_developer_savedchecks that/api/settingsreports what a freshAppStateloads from the test config root. It fails without the fixture change when$HOME/.config/diffui/settings.jsonholds non-default values, and passes with it.pytest(323 passed) with a fake home holding non-default settings and with a real one,ruff checkandruff format --checkare clean. On top of #33, with All lines saved on, the suite passes too (325).AGENTS.md's Testing note mentions the reload. Version bumped to 0.12.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Xshwvphn2wQmVKLLS2G9kJ