Output the same graph three times and check that the outputs are exactly the same. Parameters ---------- objects : str Objects to be included in the test document: 'm' for markers, 'h' for hatch patterns, 'i' for images, and 'p' for paths. fmt : {"pdf", "ps", "s
(objects, fmt, usetex)
| 169 | ] |
| 170 | ) |
| 171 | def test_determinism_check(objects, fmt, usetex): |
| 172 | """ |
| 173 | Output the same graph three times and check that the outputs are exactly the same. |
| 174 | |
| 175 | Parameters |
| 176 | ---------- |
| 177 | objects : str |
| 178 | Objects to be included in the test document: 'm' for markers, 'h' for |
| 179 | hatch patterns, 'i' for images, and 'p' for paths. |
| 180 | fmt : {"pdf", "ps", "svg"} |
| 181 | Output format. |
| 182 | """ |
| 183 | plots = [ |
| 184 | subprocess_run_for_testing( |
| 185 | [sys.executable, "-R", "-c", |
| 186 | f"from matplotlib.tests.test_determinism import _save_figure;" |
| 187 | f"_save_figure({objects!r}, {fmt!r}, {usetex})"], |
| 188 | env={**os.environ, "SOURCE_DATE_EPOCH": "946684800", |
| 189 | "MPLBACKEND": "Agg"}, |
| 190 | text=False, capture_output=True, check=True).stdout |
| 191 | for _ in range(3) |
| 192 | ] |
| 193 | for p in plots[1:]: |
| 194 | if fmt == "ps" and usetex: |
| 195 | if p != plots[0]: |
| 196 | pytest.skip("failed, maybe due to ghostscript timestamps") |
| 197 | else: |
| 198 | assert p == plots[0] |
| 199 | |
| 200 | |
| 201 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected
searching dependent graphs…