Skip to content

Commit 934182f

Browse files
Preserve the Exit Code of Running the Tests (#166)
We had been ignoring the exit code of the subprocess in runtests.py.
1 parent 4501ad8 commit 934182f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

pyperformance/tests/test_commands.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import os.path
33
import shutil
4-
import subprocess
54
import sys
65
import textwrap
76
import unittest
@@ -10,6 +9,12 @@
109
from pyperformance import tests
1110

1211

12+
CPYTHON_ONLY = unittest.skipIf(
13+
sys.implementation.name != 'cpython',
14+
'CPython-only',
15+
)
16+
17+
1318
class FullStackTests(tests.Functional, unittest.TestCase):
1419

1520
maxDiff = 80 * 100
@@ -24,12 +29,13 @@ def setUpClass(cls):
2429

2530
@classmethod
2631
def ensure_pyperformance(cls):
27-
_, stdout, _ = cls.run_python(
32+
ec, stdout, _ = cls.run_python(
2833
os.path.join(tests.DATA_DIR, 'find-pyperformance.py'),
2934
capture='stdout',
3035
onfail='raise',
3136
verbose=False,
3237
)
38+
assert ec == 0, ec
3339
stdout = stdout.strip()
3440
if stdout.strip():
3541
# It is already installed.
@@ -43,7 +49,8 @@ def ensure_pyperformance(cls):
4349
# Install it.
4450
reporoot = os.path.dirname(pyperformance.PKG_ROOT)
4551
# XXX Ignore the output (and optionally log it).
46-
cls.run_pip('install', '--editable', reporoot)
52+
ec, _, _ = cls.run_pip('install', '--editable', reporoot)
53+
assert ec == 0, ec
4754

4855
# Clean up extraneous files.
4956
egg_info = "pyperformance.egg-info"
@@ -252,6 +259,7 @@ def create_compile_config(self, *revisions,
252259
outfile.write(text)
253260
return cfgfile
254261

262+
@CPYTHON_ONLY
255263
@unittest.skip('way too slow')
256264
def test_compile(self):
257265
cfgfile = self.create_compile_config()
@@ -263,6 +271,7 @@ def test_compile(self):
263271
capture=None,
264272
)
265273

274+
@CPYTHON_ONLY
266275
@unittest.skip('way too slow')
267276
def test_compile_all(self):
268277
rev1 = '2cd268a3a934' # tag: v3.10.1
@@ -275,6 +284,7 @@ def test_compile_all(self):
275284
capture=None,
276285
)
277286

287+
@CPYTHON_ONLY
278288
@unittest.expectedFailure
279289
def test_upload(self):
280290
url = '<bogus>'

runtests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ def main():
1414
# <unreachable>
1515

1616
# Now run the tests.
17-
subprocess.run(
17+
proc = subprocess.run(
1818
[sys.executable, '-u', '-m', 'pyperformance.tests'],
1919
cwd=os.path.dirname(__file__) or None,
2020
env=dict(
2121
os.environ,
2222
PYPERFORMANCE_TESTS_VENV=venvroot,
2323
)
2424
)
25+
sys.exit(proc.returncode)
2526

2627

2728
if __name__ == "__main__":

0 commit comments

Comments
 (0)