8000 Fix backend determinism tests without nose. · matplotlib/matplotlib@9e3b260 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9e3b260

Browse files
committed
Fix backend determinism tests without nose.
1 parent 58624ff commit 9e3b260

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/matplotlib/testing/determinism.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
import sys
1414
from subprocess import check_output
1515

16+
import pytest
17+
1618
import matplotlib
1719
from matplotlib import pyplot as plt
1820

19-
from nose.plugins.skip import SkipTest
20-
2121

2222
def _determinism_save(objects='mhi', format="pdf", usetex=False):
2323
# save current value of SOURCE_DATE_EPOCH and set it
@@ -92,11 +92,11 @@ def _determinism_check(objects='mhi', format="pdf", usetex=False):
9292
format : str
9393
format string. The default value is "pdf".
9494
"""
95-
from nose.tools import assert_equal
9695
plots = []
9796
for i in range(3):
9897
result = check_output([sys.executable, '-R', '-c',
9998
'import matplotlib; '
99+
'matplotlib._called_from_pytest = True; '
100100
'matplotlib.use(%r); '
101101
'from matplotlib.testing.determinism '
102102
'import _determinism_save;'
@@ -106,9 +106,9 @@ def _determinism_check(objects='mhi', format="pdf", usetex=False):
106106
for p in plots[1:]:
107107
if usetex:
108108
if p != plots[0]:
109-
raise SkipTest("failed, maybe due to ghostscript timestamps")
109+
pytest.skip("failed, maybe due to ghostscript timestamps")
110110
else:
111-
assert_equal(p, plots[0])
111+
assert p == plots[0]
112112

113113

114114
def _determinism_source_date_epoch(format, string, keyword=b"CreationDate"):
@@ -130,6 +130,7 @@ def _determinism_source_date_epoch(format, string, keyword=b"CreationDate"):
130130
"""
131131
buff = check_output([sys.executable, '-R', '-c',
132132
'import matplotlib; '
133+
'matplotlib._called_from_pytest = True; '
133134
'matplotlib.use(%r); '
134135
'from matplotlib.testing.determinism '
135136
'import _determinism_save;'

lib/matplotlib/tests/test_backend_svg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def _test_determinism(filename, usetex):
167167
try:
168168
check_output([sys.executable, '-R', '-c',
169169
'import matplotlib; '
170+
'matplotlib._called_from_pytest = True;'
170171
'matplotlib.use("svg"); '
171172
'from matplotlib.tests.test_backend_svg '
172173
'import _test_determinism_save;'

0 commit comments

Comments
 (0)
0