From 845a2e7acae22221dcbd20dfeeaaaecf50aa2118 Mon Sep 17 00:00:00 2001 From: Aditya <147165909+ADiTyaRaj8969@users.noreply.github.com> Date: Tue, 19 May 2026 11:30:14 +0530 Subject: [PATCH] Remove obsolete Markdown theme override tests and supporting snapshot 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 --- .../test_markdown_dark_theme_override.svg | 154 ------------------ .../test_markdown_light_theme_override.svg | 154 ------------------ .../snapshot_apps/markdown_theme_switcher.py | 10 -- tests/snapshot_tests/test_snapshots.py | 12 -- 4 files changed, 330 deletions(-) delete mode 100644 tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_dark_theme_override.svg delete mode 100644 tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_light_theme_override.svg diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_dark_theme_override.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_dark_theme_override.svg deleted file mode 100644 index b7ddb86911..0000000000 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_dark_theme_override.svg +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MarkdownThemeSwitcherApp - - - - - - - - - - - -This is a H1 - - -defmain(): -print("Hello world!") - - - - - - - - - - - - - - - - - - - - diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_light_theme_override.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_light_theme_override.svg deleted file mode 100644 index bea99b82c2..0000000000 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_markdown_light_theme_override.svg +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MarkdownThemeSwitcherApp - - - - - - - - - - - -This is a H1 - - -defmain(): -print("Hello world!") - - - - - - - - - - - - - - - - - - - - diff --git a/tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.py b/tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.py index c71c26b8cb..21f6156412 100644 --- a/tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.py +++ b/tests/snapshot_tests/snapshot_apps/markdown_theme_switcher.py @@ -13,18 +13,8 @@ def main(): class MarkdownThemeSwitcherApp(App[None]): BINDINGS = [ ("t", "toggle_theme"), - ("d", "switch_dark"), - ("l", "switch_light"), ] - def action_switch_dark(self) -> None: - md = self.query_one(Markdown) - md.code_dark_theme = "solarized-dark" - - def action_switch_light(self) -> None: - md = self.query_one(Markdown) - md.code_light_theme = "solarized-light" - def action_toggle_theme(self) -> None: self.theme = "textual-light" if self.theme == "textual-dark" else "textual-dark" diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index b399c10147..b1f83e290c 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -434,18 +434,6 @@ def test_markdown_theme_switching(snap_compare): assert snap_compare(SNAPSHOT_APPS_DIR / "markdown_theme_switcher.py", press=["t"]) -def test_markdown_dark_theme_override(snap_compare): - assert snap_compare( - SNAPSHOT_APPS_DIR / "markdown_theme_switcher.py", press=["d", "wait:100"] - ) - - -def test_markdown_light_theme_override(snap_compare): - assert snap_compare( - SNAPSHOT_APPS_DIR / "markdown_theme_switcher.py", press=["l", "t", "wait:100"] - ) - - def test_checkbox_example(snap_compare): assert snap_compare(WIDGET_EXAMPLES_DIR / "checkbox.py")