Skip to content

Commit 9d62d32

Browse files
replace "python" with "sys.executable" (#157)
1 parent 49a998e commit 9d62d32

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[MASTER]
2-
py-version=3.5
2+
py-version=3.6
33
disable=R0902,R0903,R0913,R0917,R0912

cyaron/tests/compare_test.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ def test_fulltext_program(self):
8181

8282
try:
8383
with captured_output() as (out, err):
84-
Compare.program("python correct.py",
85-
"python incorrect.py",
84+
Compare.program(f"{sys.executable} correct.py",
85+
f"{sys.executable} incorrect.py",
8686
std=io,
8787
input=io,
8888
grader="FullText")
8989
except CompareMismatch as e:
90-
self.assertEqual(e.name, 'python incorrect.py')
90+
self.assertEqual(e.name, f"{sys.executable} incorrect.py")
9191
e = e.mismatch
9292
self.assertEqual(e.content, '2\n')
9393
self.assertEqual(e.std, '1\n')
@@ -120,8 +120,8 @@ def test_file_input(self):
120120
io.input_writeln("233")
121121

122122
with captured_output() as (out, err):
123-
Compare.program("python correct.py",
124-
std_program="python std.py",
123+
Compare.program(f"{sys.executable} correct.py",
124+
std_program=f"{sys.executable} std.py",
125125
input=io,
126126
grader="NOIPStyle")
127127

cyaron/tests/io_test.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import unittest
21
import os
32
import shutil
4-
import tempfile
53
import subprocess
4+
import sys
5+
import tempfile
6+
import unittest
67
from cyaron import IO
78
from cyaron.output_capture import captured_output
89

@@ -80,7 +81,8 @@ def test_output_gen_time_limit_exceeded(self):
8081

8182
try:
8283
with IO("test_gen.in", "test_gen.out") as test:
83-
test.output_gen("python long_time.py", time_limit=1)
84+
test.output_gen(f"{sys.executable} long_time.py",
85+
time_limit=1)
8486
except subprocess.TimeoutExpired:
8587
time_limit_exceeded = True
8688
self.assertEqual(time_limit_exceeded, True)
@@ -93,7 +95,8 @@ def test_output_gen_time_limit_not_exceeded(self):
9395

9496
try:
9597
with IO("test_gen.in", "test_gen.out") as test:
96-
test.output_gen("python short_time.py", time_limit=1)
98+
test.output_gen(f"{sys.executable} short_time.py",
99+
time_limit=1)
97100
except subprocess.TimeoutExpired:
98101
time_limit_exceeded = True
99102
with open("test_gen.out") as f:

0 commit comments

Comments
 (0)