99from pyperformance import tests
1010
1111
12- CPYTHON_ONLY = unittest .skipIf (
13- sys .implementation .name != 'cpython' ,
14- 'CPython-only' ,
15- )
16-
17-
1812class FullStackTests (tests .Functional , unittest .TestCase ):
1913
2014 maxDiff = 80 * 100
@@ -108,56 +102,41 @@ def div():
108102 print ('---' )
109103 print ()
110104
105+ def expect_success (* args ):
106+ text = self .run_pyperformance (
107+ * args ,
108+ capture = None ,
109+ )
110+
111+ def expect_failure (* args ):
112+ text = self .run_pyperformance (
113+ * args ,
114+ capture = None ,
115+ exitcode = 1 ,
116+ )
117+
111118 # It doesn't exist yet.
112- self .run_pyperformance (
113- 'venv' , 'show' , '--venv' , root ,
114- capture = None ,
115- )
119+ expect_success ('venv' , 'show' , '--venv' , root )
116120 div ()
117121 # It gets created.
118- self .run_pyperformance (
119- 'venv' , 'create' , '--venv' , root ,
120- capture = None ,
121- )
122+ expect_success ('venv' , 'create' , '--venv' , root )
122123 div ()
123- self .run_pyperformance (
124- 'venv' , 'show' , '--venv' , root ,
125- capture = None ,
126- )
124+ expect_success ('venv' , 'show' , '--venv' , root )
127125 div ()
128126 # It alraedy exists.
129- self .run_pyperformance (
130- 'venv' , 'create' , '--venv' , root ,
131- capture = None ,
132- exitcode = 1 ,
133- )
127+ expect_failure ('venv' , 'create' , '--venv' , root )
134128 div ()
135- self .run_pyperformance (
136- 'venv' , 'show' , '--venv' , root ,
137- capture = None ,
138- )
129+ expect_success ('venv' , 'show' , '--venv' , root )
139130 div ()
140131 # It gets re-created.
141- self .run_pyperformance (
142- 'venv' , 'recreate' , '--venv' , root ,
143- capture = None ,
144- )
132+ expect_success ('venv' , 'recreate' , '--venv' , root )
145133 div ()
146- self .run_pyperformance (
147- 'venv' , 'show' , '--venv' , root ,
148- capture = None ,
149- )
134+ expect_success ('venv' , 'show' , '--venv' , root )
150135 div ()
151136 # It get deleted.
152- self .run_pyperformance (
153- 'venv' , 'remove' , '--venv' , root ,
154- capture = None ,
155- )
137+ expect_success ('venv' , 'remove' , '--venv' , root )
156138 div ()
157- self .run_pyperformance (
158- 'venv' , 'show' , '--venv' , root ,
159- capture = None ,
160- )
139+ expect_success ('venv' , 'show' , '--venv' , root )
161140
162141 ###################################
163142 # run
@@ -170,7 +149,7 @@ def test_run_and_show(self):
170149 # --debug-single-value: benchmark results don't matter, we only
171150 # check that running benchmarks don't fail.
172151 # XXX Capture and check the output.
173- self .run_pyperformance (
152+ text = self .run_pyperformance (
174153 'run' ,
175154 '-b' , 'all' ,
176155 '--debug-single-value' ,
@@ -259,8 +238,9 @@ def create_compile_config(self, *revisions,
259238 outfile .write (text )
260239 return cfgfile
261240
262- @CPYTHON_ONLY
263- @unittest .skip ('way too slow' )
241+ @tests .CPYTHON_ONLY
242+ @tests .NON_WINDOWS_ONLY
243+ @tests .SLOW
264244 def test_compile (self ):
265245 cfgfile = self .create_compile_config ()
266246 revision = 'a58ebcc701dd' # tag: v3.10.2
@@ -271,8 +251,9 @@ def test_compile(self):
271251 capture = None ,
272252 )
273253
274- @CPYTHON_ONLY
275- @unittest .skip ('way too slow' )
254+ @tests .CPYTHON_ONLY
255+ @tests .NON_WINDOWS_ONLY
256+ @tests .SLOW
276257 def test_compile_all (self ):
277258 rev1 = '2cd268a3a934' # tag: v3.10.1
278259 rev2 = 'a58ebcc701dd' # tag: v3.10.2
@@ -284,7 +265,8 @@ def test_compile_all(self):
284265 capture = None ,
285266 )
286267
287- @CPYTHON_ONLY
268+ @tests .CPYTHON_ONLY
269+ @tests .NON_WINDOWS_ONLY
288270 @unittest .expectedFailure
289271 def test_upload (self ):
290272 url = '<bogus>'
@@ -387,8 +369,7 @@ def test_compare_wrong_version(self):
387369 Skipped 1 benchmarks only in py36.json: telco
388370
389371 Skipped 1 benchmarks only in py3_performance03.json: call_simple
390-
391- ERROR: Performance versions are different: 1.0.1 != 0.3
372+ ERROR: Performance versions are different (1.0.1 != 0.3)
392373 ''' ).lstrip ())
393374
394375 def test_compare_single_value (self ):
0 commit comments