Skip to content

Commit e80c864

Browse files
weilycoderMr-Python-in-China
authored andcommittedFeb 16, 2025·
Replace 'python' with sys.executable
1 parent fc722ac commit e80c864

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎cyaron/tests/compare_test.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ def test_fulltext_program(self):
8383

8484
try:
8585
with captured_output() as (out, err):
86-
Compare.program("python correct.py",
87-
"python incorrect.py",
86+
Compare.program(f"{sys.executable} correct.py",
87+
f"{sys.executable} incorrect.py",
8888
std=io,
8989
input=io,
9090
grader="FullText")
9191
except CompareMismatch as e:
92-
self.assertEqual(e.name, 'python incorrect.py')
92+
self.assertEqual(e.name, f'{sys.executable} incorrect.py')
9393
e = e.mismatch
9494
self.assertEqual(e.content, '2\n')
9595
self.assertEqual(e.std, '1\n')
@@ -105,7 +105,7 @@ def test_fulltext_program(self):
105105
self.assertTrue(False)
106106

107107
result = out.getvalue().strip()
108-
correct_out = 'python correct.py: Correct \npython incorrect.py: !!!INCORRECT!!! Hash mismatch: read 53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3, expected 4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865'
108+
correct_out = f'{sys.executable} correct.py: Correct \n{sys.executable} incorrect.py: !!!INCORRECT!!! Hash mismatch: read 53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3, expected 4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865'
109109
self.assertEqual(result, correct_out)
110110

111111
def test_file_input(self):
@@ -122,13 +122,13 @@ def test_file_input(self):
122122
io.input_writeln("233")
123123

124124
with captured_output() as (out, err):
125-
Compare.program("python correct.py",
126-
std_program="python std.py",
125+
Compare.program(f"{sys.executable} correct.py",
126+
std_program=f"{sys.executable} std.py",
127127
input=io,
128128
grader="NOIPStyle")
129129

130130
result = out.getvalue().strip()
131-
correct_out = 'python correct.py: Correct'
131+
correct_out = f'{sys.executable} correct.py: Correct'
132132
self.assertEqual(result, correct_out)
133133

134134
def test_concurrent(self):

0 commit comments

Comments
 (0)
Please sign in to comment.