Skip to content

Commit c2d608d

Browse files
committed
Fix: Ensure the path format is correct
1 parent 0865426 commit c2d608d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

cyaron/tests/compare_test.py

Lines changed: 7 additions & 7 deletions
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(f"{sys.executable} correct.py",
87-
f"{sys.executable} 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, f'{sys.executable} 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 = f'{sys.executable} correct.py: Correct \n{sys.executable} 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(f"{sys.executable} correct.py",
126-
std_program=f"{sys.executable} 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 = f'{sys.executable} correct.py: Correct'
131+
correct_out = f'\"{sys.executable}\" correct.py: Correct'
132132
self.assertEqual(result, correct_out)
133133

134134
def test_concurrent(self):

cyaron/tests/io_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_output_gen_time_limit_exceeded(self):
9292
abs_input_filename: str = os.path.abspath(input_filename)
9393
with self.assertRaises(subprocess.TimeoutExpired):
9494
test.input_writeln(abs_input_filename)
95-
test.output_gen(f'"{sys.executable}" long_time.py',
95+
test.output_gen(f'\"{sys.executable}\" long_time.py',
9696
time_limit=TIMEOUT)
9797
time.sleep(WAIT_TIME)
9898
try:
@@ -108,7 +108,7 @@ def test_output_gen_time_limit_not_exceeded(self):
108108
"print(1)")
109109

110110
with IO("test_gen.in", "test_gen.out") as test:
111-
test.output_gen(f'"{sys.executable}" short_time.py',
111+
test.output_gen(f'\"{sys.executable}\" short_time.py',
112112
time_limit=0.5)
113113
with open("test_gen.out", encoding="utf-8") as f:
114114
output = f.read()

0 commit comments

Comments
 (0)