Get file dialog snapshot tests passing on Windows

Now it's just a few round trip tests failing, and maybe a flaky snapshot test for the character selector dialog.
This commit is contained in:
Isaiah Odhner 2023-09-15 17:03:16 -04:00
parent 8cd164bb37
commit b6e2c245a2

View File

@ -11,6 +11,7 @@ from textual.widgets._directory_tree import DirEntry
from textual.widgets._tree import TOGGLE_STYLE, TreeNode
# from textual_paint.args import args
from textual_paint.__init__ import PYTEST
from textual_paint.ascii_mode import replace
# Vague skeuomorphism
@ -188,6 +189,12 @@ class EnhancedDirectoryTree(DirectoryTree):
A Rich Text object containing the label.
"""
node_label = node._label.copy() # type: ignore
if PYTEST and node_label.plain == "\\":
# Normalize root node display for cross-platform snapshot testing.
# (Setting pyfakefs's fs.os = OSType.LINUX caused bigger problems.)
node_label.plain = "/"
node_label.stylize(style)
if node._allow_expand: # type: ignore