Textualize / pytest-textual-snapshot

Snapshot testing for Textual applications
MIT License
21 stars 4 forks source link

Be lazy when it comes to importing Textual #3

Closed davep closed 1 year ago

davep commented 1 year ago

See https://github.com/Textualize/textual/issues/2887 for the background to this. Long story short: Textual's coverage dropped from around 86% to 66% and it looks like it was us splitting this code out into a pytest plugin that was the cause.

This plugin imports parts of Textual, which in turn means that lots of module-level code was already run before coverage-checking kicked in; by the time tests were running these imports were cached.

So this commit seeks to hold off on the imports until they're actually needed.

willmcgugan commented 1 year ago

Will leave this to @darrenburns to review