13
13
import sys
14
14
from subprocess import check_output
15
15
16
+ import pytest
17
+
16
18
import matplotlib
17
19
from matplotlib import pyplot as plt
18
20
19
- from nose .plugins .skip import SkipTest
20
-
21
21
22
22
def _determinism_save (objects = 'mhi' , format = "pdf" , usetex = False ):
23
23
# save current value of SOURCE_DATE_EPOCH and set it
@@ -92,11 +92,11 @@ def _determinism_check(objects='mhi', format="pdf", usetex=False):
92
92
format : str
93
93
format string. The default value is "pdf".
94
94
"""
95
- from nose .tools import assert_equal
96
95
plots = []
97
96
for i in range (3 ):
98
97
result = check_output ([sys .executable , '-R' , '-c' ,
99
98
'import matplotlib; '
99
+ 'matplotlib._called_from_pytest = True; '
100
100
'matplotlib.use(%r); '
101
101
'from matplotlib.testing.determinism '
102
102
'import _determinism_save;'
@@ -106,9 +106,9 @@ def _determinism_check(objects='mhi', format="pdf", usetex=False):
106
106
for p in plots [1 :]:
107
107
if usetex :
108
108
if p != plots [0 ]:
109
- raise SkipTest ("failed, maybe due to ghostscript timestamps" )
109
+ pytest . skip ("failed, maybe due to ghostscript timestamps" )
110
110
else :
111
- assert_equal ( p , plots [0 ])
111
+ assert p == plots [0 ]
112
112
113
113
114
114
def _determinism_source_date_epoch (format , string , keyword = b"CreationDate" ):
@@ -130,6 +130,7 @@ def _determinism_source_date_epoch(format, string, keyword=b"CreationDate"):
130
130
"""
131
131
buff = check_output ([sys .executable , '-R' , '-c' ,
132
132
'import matplotlib; '
133
+ 'matplotlib._called_from_pytest = True; '
133
134
'matplotlib.use(%r); '
134
135
'from matplotlib.testing.determinism '
135
136
'import _determinism_save;'
0 commit comments