@@ -75,8 +75,8 @@ directly in the right directory.
75
75
With a Hash Library
76
76
^^^^^^^^^^^^^^^^^^^
77
77
78
- Instead of comparing to baseline images, you can instead compare against a json
79
- library of sha256 hashes. This has the advantage of not having to check baseline
78
+ Instead of comparing to baseline images, you can instead compare against a JSON
79
+ library of SHA-256 hashes. This has the advantage of not having to check baseline
80
80
images into the repository with the tests, or download them from a remote
81
81
source.
82
82
@@ -91,8 +91,11 @@ Hybrid Mode: Hashes and Images
91
91
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92
92
93
93
It is possible to configure both hashes and baseline images. In this scenario
94
- the hashes will be compared first, with the baseline images only used if the hash
95
- comparison fails.
94
+ only the hash comparison can determine the test result. If the hash comparison
95
+ fails, the test will fail, however a comparison to the baseline image will be
96
+ carried out so the actual difference can be seen. If the hash comparison passes,
97
+ the comparison to the baseline image is skipped (unless **results always ** is
98
+ configured).
96
99
97
100
This is especially useful if the baseline images are external to the repository
98
101
containing the tests, and are accessed via HTTP. In this situation, if the hashes
@@ -104,7 +107,7 @@ without having to modify the external images.
104
107
Running Tests
105
108
^^^^^^^^^^^^^
106
109
107
- Once tests are written with either baseline images or a hash library to compare
110
+ Once tests are written with baseline images, a hash library, or both to compare
108
111
against, the tests can be run with::
109
112
110
113
pytest --mpl
@@ -118,12 +121,15 @@ Generating a Test Summary
118
121
^^^^^^^^^^^^^^^^^^^^^^^^^
119
122
120
123
By specifying the ``--mpl-generate-summary=html `` CLI argument, a HTML summary
121
- page will be generated showing the result, log entry and RMS of each test,
122
- and the hashes if configured. The baseline, diff and result image for each
123
- failing test will be shown. If **Results always ** is configured
124
- (see section below), images for passing tests will also be shown.
125
- If no baseline images are configured, just the result images will
126
- be displayed.
124
+ page will be generated showing the test result, log entry and generated result
125
+ image. When in the (default) image comparison mode, the baseline image, diff
126
+ image and RMS (if any), and tolerance of each test will also be shown.
127
+ When in the hash comparison mode, the baseline hash and result hash will
128
+ also be shown. When in hybrid mode, all of these are included.
129
+
130
+ When generating a HTML summary, the ``--mpl-results-always `` option is
131
+ automatically applied (see section below). Therefore images for passing
132
+ tests will also be shown.
127
133
128
134
+---------------+---------------+---------------+
129
135
| |html all | | |html filter | | |html result | |
@@ -199,20 +205,25 @@ decorator takes precedence.
199
205
Results always
200
206
^^^^^^^^^^^^^^
201
207
202
- By default, result images are only generated for tests that fail.
208
+ By default, result images are only saved for tests that fail.
203
209
Passing ``--mpl-results-always `` to pytest will force result images
204
- to be generated for all tests, even for tests that pass.
205
- If a baseline image exists, a diff image will also be generated.
206
- All of these images will be shown in the summary (if requested).
210
+ to be saved for all tests, even for tests that pass.
211
+
212
+ When in **hybrid mode **, even if a test passes hash comparison,
213
+ a comparison to the baseline image will also be carried out,
214
+ with the baseline image and diff image (if image comparison fails)
215
+ saved for all tests. This secondary comparison will not affect
216
+ the success status of the test.
207
217
208
- This option is useful for always *comparing * the result images again
218
+ This option is useful for always *comparing * the result images against
209
219
the baseline images, while only *assessing * the tests against the
210
220
hash library.
211
221
If you only update your baseline images after merging a PR, this
212
222
option means that the generated summary will always show how the
213
223
PR affects the baseline images, with the success status of each
214
224
test (based on the hash library) also shown in the generated
215
- summary.
225
+ summary. This option is applied automatically when generating
226
+ a HTML summary.
216
227
217
228
Base style
218
229
^^^^^^^^^^
0 commit comments