Skip to content

Remove obsolete Markdown theme override tests referencing removed code_*_theme attrs#6545

Closed
ADiTyaRaj8969 wants to merge 1 commit into
Textualize:mainfrom
ADiTyaRaj8969:cleanup/remove-obsolete-markdown-theme-tests
Closed

Remove obsolete Markdown theme override tests referencing removed code_*_theme attrs#6545
ADiTyaRaj8969 wants to merge 1 commit into
Textualize:mainfrom
ADiTyaRaj8969:cleanup/remove-obsolete-markdown-theme-tests

Conversation

@ADiTyaRaj8969
Copy link
Copy Markdown

Link to issue or discussion

Refs #6451

Context

#5967 removed the code_indent_guides, code_dark_theme, and code_light_theme reactive attributes from Markdown and MarkdownViewer. The cleanup, however, missed two related places in the snapshot test infrastructure:

  • The snapshot app tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.py still contained action_switch_dark / action_switch_light handlers that set code_dark_theme / code_light_theme on a Markdown instance.
  • The tests test_markdown_dark_theme_override and test_markdown_light_theme_override in tests/snapshot_tests/test_snapshots.py exercised 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 = False lines from the two documentation example files (docs/examples/widgets/markdown.py and docs/examples/widgets/markdown_viewer.py). The two PRs touch disjoint sets of files and can be merged independently.

Changes

File Change
tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.py Remove action_switch_dark, action_switch_light, and their "d" / "l" bindings. The still-supported action_toggle_theme and its "t" binding are kept.
tests/snapshot_tests/test_snapshots.py Remove test_markdown_dark_theme_override and test_markdown_light_theme_override. The remaining test_markdown_theme_switching (which presses "t" to toggle the app theme) is unchanged.
tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_dark_theme_override.svg Deleted — no longer referenced.
tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_light_theme_override.svg Deleted — no longer referenced.

Total diff: 4 files changed, 330 deletions(-). No code is added.

Why this is safe

  • The removed test handlers set attributes that have no effect on the widget since drop reactives #5967, so removing them cannot change any rendering behavior.
  • The two removed tests were producing identical-to-baseline snapshots regardless of whether the handlers ran — there is no functionality being lost from coverage.
  • The remaining test_markdown_theme_switching continues to exercise the still-supported toggle_theme action, so coverage of the live theme-switching path is preserved.

Verification

pytest --collect-only confirms the kept test is still discovered and the two obsolete tests are gone:

tests/snapshot_tests/test_snapshots.py::test_markdown_theme_switching  ✓ (kept)
test_markdown_dark_theme_override                                       ✗ (removed)
test_markdown_light_theme_override                                      ✗ (removed)

A repo-wide grep confirms no remaining references to action_switch_dark, action_switch_light, test_markdown_dark_theme_override, or test_markdown_light_theme_override.

cc @willmcgugan for sign-off per the PR template.

… 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
@willmcgugan
Copy link
Copy Markdown
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

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.

2 participants