Skip to content

Commit b51332e

Browse files
committed
Fix unit test runner on Python 3, use sys.executable.
1 parent 6ed46c9 commit b51332e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

unittests/_test_runner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _run_suites_in_isolation(self, suites):
140140
# Run test using new instance of Python interpreter
141141
try:
142142
output = subprocess.check_output(
143-
["python", "_test_runner.py", testcase_id],
143+
[sys.executable, "_test_runner.py", testcase_id],
144144
stderr=subprocess.STDOUT)
145145
exit_code = 0
146146
except subprocess.CalledProcessError as exc:
@@ -231,7 +231,9 @@ def _print_summary(self):
231231
# type: () -> None
232232
"""Print summary and exit."""
233233
print("-"*70)
234-
print("[_test_runner.py] Ran "+str(self.ran)+" tests in total")
234+
print("[_test_runner.py] Python {ver}".format(ver=sys.version[:6]))
235+
print("[_test_runner.py] Ran {ran} tests in total"
236+
.format(ran=self.ran))
235237
if self.errors or self.failures:
236238
failed_str = "[_test_runner.py] FAILED ("
237239
if self.failures:

unittests/main_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def test_main(self):
9292
# All this code must run inside one single test, otherwise strange
9393
# things happen.
9494
print("")
95+
print("Python {ver}".format(ver=sys.version[:6]))
9596

9697
# Test initialization of CEF
9798
cef.Initialize({
@@ -311,3 +312,4 @@ def py_callback(msg_from_js):
311312

312313
if __name__ == "__main__":
313314
_test_runner.main(basename(__file__))
315+

0 commit comments

Comments
 (0)