Commit d9c87aa
committed
Get rid of unique ids in SVG files.
This commit makes the following assumptions:
- SVG unique ids add a significant amount of noise to "git diff" outputs
- SVG unique ids are only necessary when embedding multiple SVG files
inside the same HTML page
- even then, it was apparently necessary to further suffix style names
- SVG snapshots are embedded only in the HTML report
- SVG unique ids are kinda hard to control due to the "distance" between
pytest and the function that actually generates them:
1. pytest_textual_snapshot.snap_compare.<locals>.compare()
2. textual._doc.take_svg_screenshot()
3. App.export_screenshot()
4. rich.Console.export_svg(... unique_id=None)
This change introduces:
- normalization of persisted SVG snapshots by stripping their ids;
- individualization of embedded SVG pictures by randomizing their ids.
Consequently:
- this change does not require to regenerate existing snapshots;
- future snapshots will not contain unique ids;
- snapshots with ids can coexist with id-less snapshots;
- conflict between embedded SVG styles is extremely unlikely despite the
removal of style name suffixes.1 parent 005ac20 commit d9c87aa
1 file changed
+22
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
36 | 49 | | |
37 | 50 | | |
38 | 51 | | |
| |||
71 | 84 | | |
72 | 85 | | |
73 | 86 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
77 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
78 | 95 | | |
79 | 96 | | |
80 | 97 | | |
| |||
301 | 318 | | |
302 | 319 | | |
303 | 320 | | |
304 | | - | |
305 | | - | |
| 321 | + | |
| 322 | + | |
306 | 323 | | |
307 | 324 | | |
308 | 325 | | |
| |||
0 commit comments