|
3 | 3 | """
|
4 | 4 |
|
5 | 5 | import os
|
6 |
| -import subprocess |
7 | 6 | import sys
|
8 | 7 |
|
9 | 8 | import pytest
|
|
12 | 11 | import matplotlib.testing.compare
|
13 | 12 | from matplotlib import pyplot as plt
|
14 | 13 | from matplotlib.testing._markers import needs_ghostscript, needs_usetex
|
| 14 | +from matplotlib.testing import subprocess_run_for_testing |
15 | 15 |
|
16 | 16 |
|
17 | 17 | def _save_figure(objects='mhi', fmt="pdf", usetex=False):
|
@@ -89,12 +89,13 @@ def test_determinism_check(objects, fmt, usetex):
|
89 | 89 | Output format.
|
90 | 90 | """
|
91 | 91 | plots = [
|
92 |
| - subprocess.check_output( |
| 92 | + subprocess_run_for_testing( |
93 | 93 | [sys.executable, "-R", "-c",
|
94 | 94 | f"from matplotlib.tests.test_determinism import _save_figure;"
|
95 | 95 | f"_save_figure({objects!r}, {fmt!r}, {usetex})"],
|
96 | 96 | env={**os.environ, "SOURCE_DATE_EPOCH": "946684800",
|
97 |
| - "MPLBACKEND": "Agg"}) |
| 97 | + "MPLBACKEND": "Agg"}, |
| 98 | + text=False, capture_output=True, check=True).stdout |
98 | 99 | for _ in range(3)
|
99 | 100 | ]
|
100 | 101 | for p in plots[1:]:
|
@@ -129,10 +130,10 @@ def test_determinism_source_date_epoch(fmt, string):
|
129 | 130 | string : bytes
|
130 | 131 | Timestamp string for 2000-01-01 00:00 UTC.
|
131 | 132 | """
|
132 |
| - buf = subprocess.check_output( |
| 133 | + buf = subprocess_run_for_testing( |
133 | 134 | [sys.executable, "-R", "-c",
|
134 | 135 | f"from matplotlib.tests.test_determinism import _save_figure; "
|
135 | 136 | f"_save_figure('', {fmt!r})"],
|
136 | 137 | env={**os.environ, "SOURCE_DATE_EPOCH": "946684800",
|
137 |
| - "MPLBACKEND": "Agg"}) |
| 138 | + "MPLBACKEND": "Agg"}, capture_output=True, text=False, check=True).stdout |
138 | 139 | assert string in buf
|
0 commit comments