Remove obsolete Markdown theme override tests referencing removed code_*_theme attrs#6545
Closed
ADiTyaRaj8969 wants to merge 1 commit into
Closed
Conversation
… app code The `Markdown.code_dark_theme` and `Markdown.code_light_theme` attributes were removed in PR #5967, but the snapshot tests `test_markdown_dark_theme_override` and `test_markdown_light_theme_override` (and their supporting actions in `markdown_theme_switcher.py`) continued to reference them. The actions set attributes that no longer have any effect on the Markdown widget, so the tests were exercising dead code paths. Changes: - Remove `action_switch_dark` / `action_switch_light` and their bindings from `tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.py`. - Remove the corresponding `test_markdown_dark_theme_override` and `test_markdown_light_theme_override` tests from `test_snapshots.py`. - Delete the now-unreferenced snapshot baselines. The remaining `test_markdown_theme_switching` test (which exercises the still-supported `toggle_theme` action) is unchanged. Refs #6451
Member
|
Your PR has been closed due to a AI policy violation. Please read the following before submitting further PRs. https://github.com/Textualize/textual/blob/main/AI_POLICY.md |
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.
Link to issue or discussion
Refs #6451
Context
#5967 removed the
code_indent_guides,code_dark_theme, andcode_light_themereactive attributes fromMarkdownandMarkdownViewer. The cleanup, however, missed two related places in the snapshot test infrastructure:tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.pystill containedaction_switch_dark/action_switch_lighthandlers that setcode_dark_theme/code_light_themeon aMarkdowninstance.test_markdown_dark_theme_overrideandtest_markdown_light_theme_overrideintests/snapshot_tests/test_snapshots.pyexercised those handlers via key presses ("d","l").Because the attributes no longer exist on the widget, the action handlers were setting plain instance attributes that have no effect on rendering. The two tests were therefore comparing snapshots of an unchanged Markdown render against baselines that captured the same unchanged render — they were dead tests.
This was reported by @Jackenmen in #6451 along with a complete proposed diff.
Scope
This PR is complementary to #6486 (also by @Jackenmen), which removes the related
code_indent_guides = Falselines from the two documentation example files (docs/examples/widgets/markdown.pyanddocs/examples/widgets/markdown_viewer.py). The two PRs touch disjoint sets of files and can be merged independently.Changes
tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.pyaction_switch_dark,action_switch_light, and their"d"/"l"bindings. The still-supportedaction_toggle_themeand its"t"binding are kept.tests/snapshot_tests/test_snapshots.pytest_markdown_dark_theme_overrideandtest_markdown_light_theme_override. The remainingtest_markdown_theme_switching(which presses"t"to toggle the app theme) is unchanged.tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_dark_theme_override.svgtests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_light_theme_override.svgTotal diff: 4 files changed, 330 deletions(-). No code is added.
Why this is safe
test_markdown_theme_switchingcontinues to exercise the still-supportedtoggle_themeaction, so coverage of the live theme-switching path is preserved.Verification
pytest --collect-onlyconfirms the kept test is still discovered and the two obsolete tests are gone:A repo-wide grep confirms no remaining references to
action_switch_dark,action_switch_light,test_markdown_dark_theme_override, ortest_markdown_light_theme_override.cc @willmcgugan for sign-off per the PR template.