@@ -86,11 +86,11 @@ def test_fails(tmpdir):
86
86
f .write (TEST_FAILING )
87
87
88
88
# If we use --mpl, it should detect that the figure is wrong
89
- code = subprocess .call ('py.test -- mpl {0 }' .format (test_file ), shell = True )
89
+ code = subprocess .call ('{0} -m pytest -- mpl {1 }' .format (sys . executable , test_file ), shell = True )
90
90
assert code != 0
91
91
92
92
# If we don't use --mpl option, the test should succeed
93
- code = subprocess .call ('py.test {0}' .format (test_file ), shell = True )
93
+ code = subprocess .call ('{0} -m pytest {1} ' .format (sys . executable , test_file ), shell = True )
94
94
assert code == 0
95
95
96
96
@@ -113,7 +113,7 @@ def test_output_dir(tmpdir):
113
113
114
114
# When we run the test, we should get output images where we specify
115
115
output_dir = tmpdir .join ('test_output_dir' ).strpath
116
- code = subprocess .call ('py.test -- mpl-results-path={0 } --mpl {1 }' .format (output_dir , test_file ),
116
+ code = subprocess .call ('{0} -m pytest -- mpl-results-path={1 } --mpl {2 }' .format (sys . executable , output_dir , test_file ),
117
117
shell = True )
118
118
119
119
assert code != 0
@@ -150,13 +150,13 @@ def test_generate(tmpdir):
150
150
gen_dir = tmpdir .mkdir ('spam' ).mkdir ('egg' ).strpath
151
151
152
152
# If we don't generate, the test will fail
153
- p = subprocess .Popen ('py.test -- mpl {0 }' .format (test_file ), shell = True ,
153
+ p = subprocess .Popen ('{0} -m pytest -- mpl {1 }' .format (sys . executable , test_file ), shell = True ,
154
154
stdout = subprocess .PIPE , stderr = subprocess .PIPE )
155
155
p .wait ()
156
156
assert b'Image file not found for comparison test' in p .stdout .read ()
157
157
158
158
# If we do generate, the test should succeed and a new file will appear
159
- code = subprocess .call ('py.test -- mpl-generate-path={0 } {1 }' .format (gen_dir , test_file ), shell = True )
159
+ code = subprocess .call ('{0} -m pytest -- mpl-generate-path={1 } {2 }' .format (sys . executable , gen_dir , test_file ), shell = True )
160
160
assert code == 0
161
161
assert os .path .exists (os .path .join (gen_dir , 'test_gen.png' ))
162
162
0 commit comments