Skip to content

Commit d47fb2a

Browse files
authored
Fix python version used to run tests (#426)
1 parent 2e39b27 commit d47fb2a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/check-exercises.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
import json
1313

1414

15+
def python_executable_name():
16+
return 'python{}.{}'.format(sys.version_info.major, sys.version_info.minor)
17+
18+
1519
def check_assignment(name, test_file):
1620
# Returns the exit code of the tests
1721
workdir = tempfile.mkdtemp(name)
@@ -21,7 +25,7 @@ def check_assignment(name, test_file):
2125
shutil.copyfile(test_file, test_file_out)
2226
shutil.copyfile(os.path.join(os.path.dirname(test_file), 'example.py'),
2327
os.path.join(workdir, '{}.py'.format(example_name)))
24-
return subprocess.call(['python', test_file_out])
28+
return subprocess.call([python_executable_name(), test_file_out])
2529
finally:
2630
shutil.rmtree(workdir)
2731

@@ -91,6 +95,8 @@ def main():
9195
failures.append('{} (TestFailed)'.format(exercise))
9296
print('')
9397

98+
print('TestEnvironment:', python_executable_name().capitalize(), end='\n\n')
99+
94100
if failures:
95101
print('FAILURES: ', ', '.join(failures))
96102
raise SystemExit(1)

0 commit comments

Comments
 (0)