Information about testing #551
-
Hi @tconbeer! I am working on adding a TUI to our package nf-core/tools, currently implementing the snapshot tests. I see your tests are asyncio events and then you are able to generate a snapshot with Thank you very much for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Basically, it uses Textual's built-in screenshotting capabilities and stores the SVG screenshot as a data snapshot with Syrupy. If the SVG changes between test runs, the test fails. Textualize's package uses a fixture called These tests are easy to get started with, but frankly a pain to maintain. They are super brittle (changing a single pixel on the screen will fail the test -- sometimes the changes aren't even visible once the browser renders the SVG, since they're to hidden elements, etc.). They also execute pretty slowly. The tradeoffs are worth it to me, because I really care about quality, but they significantly slow down development. |
Beta Was this translation helpful? Give feedback.
app_snapshot
is a pytest fixture that is defined by thepytest-textual-snapshot
test dependency in Harlequin. I use my fork of Textualize's package. You need to install that package as a dependency before using the fixture; I don't recommend installing from my repo without forking it first, since I might change that at any time for Harlequin's purposes and break your stuff.Basically, it uses Textual's built-in screenshotting capabilities and stores the SVG screenshot as a data snapshot with Syrupy. If the SVG changes between test runs, the test fails.
Textualize's package uses a fixture called
snap_compare
, which takes the path to an App file and a sequence of keystrokes. My fork adds the…