Skip to content

Fix python version used to run tests #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/check-exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import json


def python_executable_name():
return 'python{}.{}'.format(sys.version_info.major, sys.version_info.minor)


def check_assignment(name, test_file):
# Returns the exit code of the tests
workdir = tempfile.mkdtemp(name)
Expand All @@ -21,7 +25,7 @@ def check_assignment(name, test_file):
shutil.copyfile(test_file, test_file_out)
shutil.copyfile(os.path.join(os.path.dirname(test_file), 'example.py'),
os.path.join(workdir, '{}.py'.format(example_name)))
return subprocess.call(['python', test_file_out])
return subprocess.call([python_executable_name(), test_file_out])
finally:
shutil.rmtree(workdir)

Expand Down Expand Up @@ -91,6 +95,8 @@ def main():
failures.append('{} (TestFailed)'.format(exercise))
print('')

print('TestEnvironment:', python_executable_name().capitalize(), end='\n\n')

if failures:
print('FAILURES: ', ', '.join(failures))
raise SystemExit(1)
Expand Down