Closed paul-ollis closed 2 months ago
Please hold off merging this for now.
I have identified an improvement that I wish to add.
Updates made. Once again ready for review and potential merging.
@paul-ollis Sorry for the slow response on this. Going to have a chat with @darrenburns shortly. We're very excited about faster snapshots!
@willmcgugan No worries. I have not actively made use of this for some months, but seem to recall that when I was, I may have found some tweaks/corner cases that cropped up during heavy use. I will revisit the project in question and get back to you with any possibly useful updates or a definitive 'no changes required'.
I hope you find it as useful as me.
Attention grabbing bit
On my PC, which has 16 (real) cores.
Time to run the Textual suite of 2107 tests.
Details
The following changes have been made.
Store each test's snapshot in a separate file to avoid multiple processes trying to write to a single 'ambr' file. Each snapshot is now a plain SVG file.
Store test run snapshot results in a temporary directory, one per test. The main process loads these when the test run has completed.
A slightly non-related change. The actual SVG is modified to make the styles unique with respect to those in the previous SVG, before being added to the HTML failure report.
When a snapshot comparison fails it is possible for the two SVGs can have different style sets. These are merged when the HTML file is rendered which can give rise to misleading differences in colour, bold, etc.
In order to make use of pytest-xdist for the Textual tests you must:
Use the --dist=loadgroup option when executing pytest.
Add pytest-xdist group decorators to the slug tests.
The slug tests depend on execution order and state that changes for each test. So each parameterized set of tests must run within the same pytest-xdist worker process.