Comments (13)
There is a very curious line here...
https://github.com/Textualize/textual/blob/main/src/textual/command.py#L389
Seems relevant
from textual.
Yes - it seems to be an issue where if you run the command palette snapshot tests and unit tests it produces different output vs running the command palette snapshots in isolation.
It's been driving me nuts the past couple of days because I have to run every single test and then run them again to generate new snapshots.
from textual.
Thanks Darren for confirming it isn't just me!
Initially I didn't spot any visual difference until I looked a bit closer!
I'm struggling to understand why the SVG fill would change depending on how you run the tests though!
from textual.
Yeah, I remember this issue was happening in the past, and adding that line seemed to workaround it. The issue seems to have returned though - the workaround is no longer working!
from textual.
If I recall correctly, the original issue was the the segments for the emoji had a different "color" attribute in the output SVG. Hardcoding the color in the CSS for SearchIcon resulted in a constant color.
I'm guessing the recent change to SVGs to normalise them has broken the workaround here 🤷.
from textual.
Do we also need to hardcode the background color of the SearchIcon? 🤠
(Even if this does happen to fix it I'd still love to know what is going on 😆)
from textual.
I'm guessing the recent change to SVGs to normalise them has broken the workaround here 🤷.
I think more likely the recent changes to the OptionList and/or CommandPalette in #4667, maybe where the background changed to transparent?
From a quick git bisect
this issue started with the snapshot update in 793fcbd.
from textual.
Confirmed that hardcoding a non-transparent
background in the SearchIcon
DEFAULT_CSS resolves the snapshot test issue (e.g. background: red;
).
With that change in place, I can run the following commands and they all succeed (this currently fails on main
):
Update the snapshots:
pytest tests/input/test_input_clear.py tests/snapshot_tests/ -k test_command_palette --snapshot-update
Check the command palette tests pass in isolation:
PASS:
pytest tests/snapshot_tests/test_snapshots.py::test_command_palette
PASS:
pytest tests/snapshot_tests/test_snapshots.py::test_command_palette_discovery
from textual.
Also works if we get rid of the emoji, which is always a good solution 😉
from textual.
Can you print out the list of segments for both paths, and compare?
I can think of no earthy reason why they might differ, tbh.
from textual.
I was thinking this is an issue around global caches - for example an @lru_cache
is global and will persist across tests.
Perhaps some background color is being computed from transparent
in the first test, being stored in the cache, then the same cache is being hit in the second test?
@willmcgugan I checked the SVG in the past and it was just the background color which differs - you can also see the background color differing on the snapshot test output if you look closely.
from textual.
The @lru_cache is a sound theory. Easy to test. We could remove all the lru_caches.
from textual.
Tried but no luck. Although there are also some inside Rich that I didn't remove.
from textual.
Related Issues (20)
- Trying to remove Footer results in "node has no screen" HOT 3
- Integer validator does not work as expected permitting floating point numbers HOT 1
- DataTable.add_row gives misleading error with too many arguments. HOT 2
- ScrollView initial scroll before mount
- TabPane selectable when disabled HOT 4
- `ListView.remove_items()` removes all items HOT 1
- DataTable: Switching focus is slow when table contains lots of data HOT 4
- Markdown widget - hyperlinks does not open browser on click HOT 5
- Dynamic Bindings HOT 2
- Tree.scroll_to_line() off-by-2 error in x coordinate? HOT 3
- documentation issues HOT 7
- Dynamic actions sharing the same keybinding HOT 6
- CommandPalette only works when `App.AUTO_FOCUS="*"` HOT 1
- set_reactive02.py does not run (AttributeError: 'Greeter' object has no attribute 'set_reactive') HOT 7
- Clarify API docs following titles change? HOT 3
- Reduce font size for params in docs? HOT 5
- How to refresh DirectoryTree to see new files/folders? HOT 10
- `DataTable` height maybe doesn't account for horizontal scrollbar? HOT 3
- Textual leaves Kitty terminal broken HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textual.