Skip to content

Commit

Permalink
test/check_exercises.py: improve portability (#1626)
Browse files Browse the repository at this point in the history
Closes #1625
  • Loading branch information
cmccandless committed Dec 7, 2018
1 parent 85f5e02 commit 313d1d1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/check-exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
ALLOW_SKIP = ['alphametics', 'largest-series-product']


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 @@ -33,7 +29,7 @@ def check_assignment(name, test_file):
dst_file.writelines(lines)
shutil.copyfile(os.path.join(os.path.dirname(test_file), 'example.py'),
os.path.join(workdir, '{}.py'.format(example_name)))
return subprocess.call([python_executable_name(), test_file_out])
return subprocess.call([sys.executable, test_file_out])
finally:
shutil.rmtree(workdir)

Expand Down Expand Up @@ -76,7 +72,7 @@ def main():
failures.append('{} (TestFailed)'.format(exercise))
print('')

print('TestEnvironment:', python_executable_name().capitalize(), '\n\n')
print('TestEnvironment:', sys.executable.capitalize(), '\n\n')

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

0 comments on commit 313d1d1

Please sign in to comment.