From e36f315f65ffe92bbc2310ecced3a7585e7c5663 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Fri, 2 Feb 2024 13:16:57 -0500 Subject: [PATCH 1/4] Use a CSS file for the tree reporter's style rules Previously we were declaring these styles in the Python source code, but moving them into a dedicated `.css` file allows hot reloading to work when using `textual run --dev`, and causes the rules to take effect in some situations when they otherwise would be ignored or overridden. Signed-off-by: Matt Wozniski --- src/memray/reporters/tree.css | 29 +++++++++++++++++++++++++++++ src/memray/reporters/tree.py | 30 +----------------------------- 2 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 src/memray/reporters/tree.css diff --git a/src/memray/reporters/tree.css b/src/memray/reporters/tree.css new file mode 100644 index 0000000000..2f7300323c --- /dev/null +++ b/src/memray/reporters/tree.css @@ -0,0 +1,29 @@ +Label { + padding: 1 3; +} + +#frame-detail-grid Label { + color: $text; + height: auto; + width: 100%; + background: $panel-lighten-1; +} + +#frame-detail-grid { + grid-size: 1 2; + grid-gutter: 1 2; + padding: 0 1; + border: thick $background 80%; + background: $surface; +} + +#detailcol { + width: 40%; + max-width: 100; +} + +TextArea { + scrollbar-size-vertical: 0; + border: none; + padding: 0; +} diff --git a/src/memray/reporters/tree.py b/src/memray/reporters/tree.py index ea999e7eef..4d224fd145 100644 --- a/src/memray/reporters/tree.py +++ b/src/memray/reporters/tree.py @@ -230,35 +230,7 @@ class TreeApp(App[None]): ), ] - DEFAULT_CSS = """ - Label { - padding: 1 3; - } - - #frame-detail-grid Label { - color: $text; - height: auto; - width: 100%; - background: $panel-lighten-1; - } - - #frame-detail-grid { - grid-size: 1 2; - grid-gutter: 1 2; - padding: 0 1; - border: thick $background 80%; - background: $surface; - } - - #detailcol { - width: 40%; - max-width: 100; - } - - TextArea { - scrollbar-size-vertical: 0; - } - """ + CSS_PATH = "tree.css" def __init__( self, From fc8e0c84db28f4118ec6dc3b044f2131b3926abc Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Fri, 2 Feb 2024 11:01:43 -0500 Subject: [PATCH 2/4] tree: Disable soft wrapping for textual `TextArea` Textual 0.48 introduces a breaking change for the `TextArea` widget: line wrapping is now enabled by default. Since we don't want line wrapping, we need to disable that. We can do so by simply assigning `False` to the `soft_wrap` reactive property. Older versions of Textual don't have that property, but they totally ignore this assignment, so assigning this doesn't affect backwards compatibility. Signed-off-by: Matt Wozniski --- src/memray/reporters/tree.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/memray/reporters/tree.py b/src/memray/reporters/tree.py index 4d224fd145..09e5b23214 100644 --- a/src/memray/reporters/tree.py +++ b/src/memray/reporters/tree.py @@ -181,6 +181,7 @@ def compose(self) -> ComposeResult: text.show_line_numbers = False text.can_focus = False text.cursor_blink = False + text.soft_wrap = False labels: list[Label] = [] content_by_label_id = self._get_content_by_label_id() From 353a4f101895b10ceb92d946a0a89751f51891c8 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Fri, 2 Feb 2024 13:36:18 -0500 Subject: [PATCH 3/4] tests: Update snapshots for Textual 0.48 The snapshot diff shows that the only difference is a slight change to the rendering of some of the characters in the capture, rather than anything our users would be able to observe. Signed-off-by: Matt Wozniski --- .../__snapshots__/test_tree_reporter.ambr | 860 +++++++++--------- 1 file changed, 430 insertions(+), 430 deletions(-) diff --git a/tests/unit/__snapshots__/test_tree_reporter.ambr b/tests/unit/__snapshots__/test_tree_reporter.ambr index 4ab4314de8..1f0557c570 100644 --- a/tests/unit/__snapshots__/test_tree_reporter.ambr +++ b/tests/unit/__snapshots__/test_tree_reporter.ambr @@ -1166,291 +1166,291 @@ font-weight: 700; } - .terminal-1939011024-matrix { + .terminal-4035773514-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1939011024-title { + .terminal-4035773514-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1939011024-r1 { fill: #e2e3e3 } - .terminal-1939011024-r2 { fill: #cd5c5c } - .terminal-1939011024-r3 { fill: #e2e3e3;font-weight: bold } - .terminal-1939011024-r4 { fill: #141414 } - .terminal-1939011024-r5 { fill: #c5c8c6 } - .terminal-1939011024-r6 { fill: #008139 } - .terminal-1939011024-r7 { fill: #4c707e } - .terminal-1939011024-r8 { fill: #f8f8f2 } - .terminal-1939011024-r9 { fill: #282a36 } - .terminal-1939011024-r10 { fill: #211505;font-weight: bold } - .terminal-1939011024-r11 { fill: #794f14;font-weight: bold } - .terminal-1939011024-r12 { fill: #fea62b;font-weight: bold } - .terminal-1939011024-r13 { fill: #23568b } - .terminal-1939011024-r14 { fill: #e1e1e1 } - .terminal-1939011024-r15 { fill: #e4e5e6 } - .terminal-1939011024-r16 { fill: #dde8f3;font-weight: bold } - .terminal-1939011024-r17 { fill: #ddedf9 } + .terminal-4035773514-r1 { fill: #e2e3e3 } + .terminal-4035773514-r2 { fill: #cd5c5c } + .terminal-4035773514-r3 { fill: #e2e3e3;font-weight: bold } + .terminal-4035773514-r4 { fill: #141414 } + .terminal-4035773514-r5 { fill: #c5c8c6 } + .terminal-4035773514-r6 { fill: #008139 } + .terminal-4035773514-r7 { fill: #4c707e } + .terminal-4035773514-r8 { fill: #f8f8f2 } + .terminal-4035773514-r9 { fill: #282a36 } + .terminal-4035773514-r10 { fill: #211505;font-weight: bold } + .terminal-4035773514-r11 { fill: #794f14;font-weight: bold } + .terminal-4035773514-r12 { fill: #fea62b;font-weight: bold } + .terminal-4035773514-r13 { fill: #23568b } + .terminal-4035773514-r14 { fill: #e1e1e1 } + .terminal-4035773514-r15 { fill: #e4e5e6 } + .terminal-4035773514-r16 { fill: #dde8f3;font-weight: bold } + .terminal-4035773514-r17 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TreeApp + TreeApp - - - - โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) <ROOT>โ–ˆโ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–ˆ - โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) grandparentfun.py:4โ–ˆdef generate_primes():                      โ–ˆ - โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) parentfun.py:8โ–ˆ    numbers = itertools.count(2)            โ–ˆ - โ”—โ”โ” ๐Ÿ“„ 1.000KB (100.00 %) mefun.py:12โ–ˆ    while True:                             โ–ˆ - โ–ˆ        prime = next(numbers)               โ–ˆ - โ–ˆ        yield prime                         โ–ˆ - โ–ˆ        numbers = filter(lambda x, prime=priโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–Œโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงญ Function: parentโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงญ Location: fun.py:8โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿ’พ Allocations: 1โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿ“ฆ Size: 1.000KBโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงต Thread: 0x1โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–ˆ -  Q  Quit the app  I  Hide import system  U  Show uninteresting  E  Expand linear group  + + + + โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) <ROOT>โ–ˆโ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–ˆ + โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) grandparentfun.py:4โ–ˆdef generate_primes():                      โ–ˆ + โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) parentfun.py:8โ–ˆ    numbers = itertools.count(2) โ–ˆ + โ”—โ”โ” ๐Ÿ“„ 1.000KB (100.00 %) mefun.py:12โ–ˆ    while True: โ–ˆ + โ–ˆ        prime = next(numbers) โ–ˆ + โ–ˆ        yield prime โ–ˆ + โ–ˆ        numbers = filter(lambda x, prime=priโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–Œโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงญ Function: parentโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงญ Location: fun.py:8โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿ’พ Allocations: 1โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿ“ฆ Size: 1.000KBโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงต Thread: 0x1โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–ˆ +  Q  Quit the app  I  Hide import system  U  Show uninteresting  E  Expand linear group  @@ -2023,290 +2023,290 @@ font-weight: 700; } - .terminal-2565870658-matrix { + .terminal-3547620932-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2565870658-title { + .terminal-3547620932-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2565870658-r1 { fill: #e2e3e3 } - .terminal-2565870658-r2 { fill: #cd5c5c } - .terminal-2565870658-r3 { fill: #e2e3e3;font-weight: bold } - .terminal-2565870658-r4 { fill: #141414 } - .terminal-2565870658-r5 { fill: #c5c8c6 } - .terminal-2565870658-r6 { fill: #008139 } - .terminal-2565870658-r7 { fill: #4c707e } - .terminal-2565870658-r8 { fill: #f8f8f2 } - .terminal-2565870658-r9 { fill: #282a36 } - .terminal-2565870658-r10 { fill: #211505;font-weight: bold } - .terminal-2565870658-r11 { fill: #794f14;font-weight: bold } - .terminal-2565870658-r12 { fill: #23568b } - .terminal-2565870658-r13 { fill: #e1e1e1 } - .terminal-2565870658-r14 { fill: #e4e5e6 } - .terminal-2565870658-r15 { fill: #dde8f3;font-weight: bold } - .terminal-2565870658-r16 { fill: #ddedf9 } + .terminal-3547620932-r1 { fill: #e2e3e3 } + .terminal-3547620932-r2 { fill: #cd5c5c } + .terminal-3547620932-r3 { fill: #e2e3e3;font-weight: bold } + .terminal-3547620932-r4 { fill: #141414 } + .terminal-3547620932-r5 { fill: #c5c8c6 } + .terminal-3547620932-r6 { fill: #008139 } + .terminal-3547620932-r7 { fill: #4c707e } + .terminal-3547620932-r8 { fill: #f8f8f2 } + .terminal-3547620932-r9 { fill: #282a36 } + .terminal-3547620932-r10 { fill: #211505;font-weight: bold } + .terminal-3547620932-r11 { fill: #794f14;font-weight: bold } + .terminal-3547620932-r12 { fill: #23568b } + .terminal-3547620932-r13 { fill: #e1e1e1 } + .terminal-3547620932-r14 { fill: #e4e5e6 } + .terminal-3547620932-r15 { fill: #dde8f3;font-weight: bold } + .terminal-3547620932-r16 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TreeApp + TreeApp - - - - โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) <ROOT>โ–ˆโ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–ˆ - โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) grandparent2fun2.py:4โ–ˆimport itertools                            โ–ˆ - โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) parent2fun2.py:8โ–ˆdef generate_primes():                      โ–ˆ - โ””โ”€โ”€ ๐Ÿ“„ 1.000KB (100.00 %) me2func2.py:4โ–ˆ    numbers = itertools.count(2)            โ–ˆ - โ–ˆ    while True:                             โ–ˆ - โ–ˆ        prime = next(numbers)               โ–ˆ - โ–ˆ        yield prime                         โ–ˆ - โ–ˆ        numbers = filter(lambda x, prime=priโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–Œโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงญ Function: me2โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงญ Location: func2.py:4โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿ’พ Allocations: 1โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿ“ฆ Size: 1.000KBโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงต Thread: 0x1โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–ˆ -  Q  Quit the app  I  Hide import system  U  Show uninteresting  E  Expand linear group  + + + + โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) <ROOT>โ–ˆโ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–ˆ + โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) grandparent2fun2.py:4โ–ˆimport itertools                            โ–ˆ + โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (100.00 %) parent2fun2.py:8โ–ˆdef generate_primes(): โ–ˆ + โ””โ”€โ”€ ๐Ÿ“„ 1.000KB (100.00 %) me2func2.py:4โ–ˆ    numbers = itertools.count(2) โ–ˆ + โ–ˆ    while True: โ–ˆ + โ–ˆ        prime = next(numbers) โ–ˆ + โ–ˆ        yield prime โ–ˆ + โ–ˆ        numbers = filter(lambda x, prime=priโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–Œโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงญ Function: me2โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงญ Location: func2.py:4โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿ’พ Allocations: 1โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿ“ฆ Size: 1.000KBโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงต Thread: 0x1โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–ˆ +  Q  Quit the app  I  Hide import system  U  Show uninteresting  E  Expand linear group  @@ -3272,293 +3272,293 @@ font-weight: 700; } - .terminal-744288475-matrix { + .terminal-3900064492-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-744288475-title { + .terminal-3900064492-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-744288475-r1 { fill: #e2e3e3 } - .terminal-744288475-r2 { fill: #cd5c5c } - .terminal-744288475-r3 { fill: #e2e3e3;font-weight: bold } - .terminal-744288475-r4 { fill: #141414 } - .terminal-744288475-r5 { fill: #c5c8c6 } - .terminal-744288475-r6 { fill: #008139 } - .terminal-744288475-r7 { fill: #d96845 } - .terminal-744288475-r8 { fill: #4c707e } - .terminal-744288475-r9 { fill: #f8f8f2 } - .terminal-744288475-r10 { fill: #282a36 } - .terminal-744288475-r11 { fill: #211505;font-weight: bold } - .terminal-744288475-r12 { fill: #794f14;font-weight: bold } - .terminal-744288475-r13 { fill: #fea62b;font-weight: bold } - .terminal-744288475-r14 { fill: #80b725 } - .terminal-744288475-r15 { fill: #23568b } - .terminal-744288475-r16 { fill: #e1e1e1 } - .terminal-744288475-r17 { fill: #e4e5e6 } - .terminal-744288475-r18 { fill: #dde8f3;font-weight: bold } - .terminal-744288475-r19 { fill: #ddedf9 } + .terminal-3900064492-r1 { fill: #e2e3e3 } + .terminal-3900064492-r2 { fill: #cd5c5c } + .terminal-3900064492-r3 { fill: #e2e3e3;font-weight: bold } + .terminal-3900064492-r4 { fill: #141414 } + .terminal-3900064492-r5 { fill: #c5c8c6 } + .terminal-3900064492-r6 { fill: #008139 } + .terminal-3900064492-r7 { fill: #d96845 } + .terminal-3900064492-r8 { fill: #4c707e } + .terminal-3900064492-r9 { fill: #f8f8f2 } + .terminal-3900064492-r10 { fill: #282a36 } + .terminal-3900064492-r11 { fill: #211505;font-weight: bold } + .terminal-3900064492-r12 { fill: #794f14;font-weight: bold } + .terminal-3900064492-r13 { fill: #fea62b;font-weight: bold } + .terminal-3900064492-r14 { fill: #80b725 } + .terminal-3900064492-r15 { fill: #23568b } + .terminal-3900064492-r16 { fill: #e1e1e1 } + .terminal-3900064492-r17 { fill: #e4e5e6 } + .terminal-3900064492-r18 { fill: #dde8f3;font-weight: bold } + .terminal-3900064492-r19 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - TreeApp + TreeApp - - - - โ–ผ ๐Ÿ“‚ 11.000KB (100.00 %) <ROOT>โ–ˆโ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–ˆ - โ”œโ”€โ”€ โ–ผ ๐Ÿ“‚ 10.000KB (90.91 %) grandparent2fun2.py:4โ–ˆimport itertools                            โ–ˆ - โ”‚   โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 10.000KB (90.91 %) parent2fun2.py:8โ–ˆdef generate_primes():                      โ–ˆ - โ”‚   โ””โ”€โ”€ ๐Ÿ“„ 10.000KB (90.91 %) me2fun2.py:12โ–ˆ    numbers = itertools.count(2)            โ–ˆ - โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) efun.py:5โ–ˆ    while True:                             โ–ˆ - โ”—โ”โ” โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) dfun.py:4โ–ˆ        prime = next(numbers)               โ–ˆ - โ”—โ”โ” โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) cfun.py:3โ–ˆ        yield prime                         โ–ˆ - โ”—โ”โ” โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) bfun.py:2โ–ˆ        numbers = filter(lambda x, prime=priโ–ˆ - โ”—โ”โ” ๐Ÿ“„ 1.000KB (9.09 %) afun.py:1โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–Œโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงญ Function: eโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงญ Location: fun.py:5โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿ’พ Allocations: 1โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿ“ฆ Size: 1.000KBโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆ๐Ÿงต Thread: 0x1โ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–ˆ - โ–ˆโ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–ˆ -  Q  Quit the app  I  Hide import system  U  Show uninteresting  E  Expand linear group  + + + + โ–ผ ๐Ÿ“‚ 11.000KB (100.00 %) <ROOT>โ–ˆโ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–ˆ + โ”œโ”€โ”€ โ–ผ ๐Ÿ“‚ 10.000KB (90.91 %) grandparent2fun2.py:4โ–ˆimport itertools                            โ–ˆ + โ”‚   โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 10.000KB (90.91 %) parent2fun2.py:8โ–ˆdef generate_primes(): โ–ˆ + โ”‚   โ””โ”€โ”€ ๐Ÿ“„ 10.000KB (90.91 %) me2fun2.py:12โ–ˆ    numbers = itertools.count(2) โ–ˆ + โ””โ”€โ”€ โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) efun.py:5โ–ˆ    while True: โ–ˆ + โ”—โ”โ” โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) dfun.py:4โ–ˆ        prime = next(numbers) โ–ˆ + โ”—โ”โ” โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) cfun.py:3โ–ˆ        yield prime โ–ˆ + โ”—โ”โ” โ–ผ ๐Ÿ“‚ 1.000KB (9.09 %) bfun.py:2โ–ˆ        numbers = filter(lambda x, prime=priโ–ˆ + โ”—โ”โ” ๐Ÿ“„ 1.000KB (9.09 %) afun.py:1โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–Œโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงญ Function: eโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงญ Location: fun.py:5โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿ’พ Allocations: 1โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿ“ฆ Size: 1.000KBโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆ๐Ÿงต Thread: 0x1โ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–ˆ + โ–ˆโ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–ˆ +  Q  Quit the app  I  Hide import system  U  Show uninteresting  E  Expand linear group  From 88fbf5876234b02d37faa7a9994159b081faf2b8 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Fri, 2 Feb 2024 14:46:50 -0500 Subject: [PATCH 4/4] tests: Skip some snapshot tests on Python 3.7 The latest versions of Textual only support Python 3.8 and higher, so differences from the snapshot are expected when running Python 3.7. Signed-off-by: Matt Wozniski --- tests/conftest.py | 10 ++++++++++ tests/unit/test_tree_reporter.py | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 91f1283aa2..b708e04a05 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import socket +import sys import pytest @@ -10,3 +11,12 @@ def free_port(): port_number = s.getsockname()[1] s.close() return port_number + + +def pytest_configure(config): + # Several of the tree reporter tests require Textual 0.48, which does not + # support Python 3.7, but skipping those tests causes the test suite to + # fail due to unused snapshots. Override the configuration for Python 3.7 + # so that unused snapshots are a warning, not an error. + if sys.version_info < (3, 8): + config.option.warn_unused_snapshots = True diff --git a/tests/unit/test_tree_reporter.py b/tests/unit/test_tree_reporter.py index b73f3b62b5..bb772b56c4 100644 --- a/tests/unit/test_tree_reporter.py +++ b/tests/unit/test_tree_reporter.py @@ -1,3 +1,4 @@ +import sys from dataclasses import dataclass from textwrap import dedent from typing import Any @@ -1594,6 +1595,10 @@ def generate_primes(): getlines.return_value = code.splitlines() assert compare(peak_allocations, press=[]) + @pytest.mark.skipif( + sys.version_info < (3, 8), + reason="This test requires Textual 0.48 or higher, which doesn't support 3.7", + ) def test_basic_node_selected_not_leaf(self, compare): # GIVEN code = dedent( @@ -1709,6 +1714,10 @@ def generate_primes(): getlines.return_value = code.splitlines() assert compare(peak_allocations, press=[]) + @pytest.mark.skipif( + sys.version_info < (3, 8), + reason="This test requires Textual 0.48 or higher, which doesn't support 3.7", + ) def test_two_chains_after_expanding_second(self, compare): # GIVEN code = dedent( @@ -1909,6 +1918,10 @@ def generate_primes(): getlines.return_value = code.splitlines() assert compare(peak_allocations, press=["u", "i"]) + @pytest.mark.skipif( + sys.version_info < (3, 8), + reason="This test requires Textual 0.48 or higher, which doesn't support 3.7", + ) def test_select_screen(self, tmp_path, compare): # GIVEN code = dedent(