44import shutil
55import tempfile
66import subprocess
7- from cyaron import IO , Compare , log
7+ from cyaron import IO , Compare , log , escape_path
88from cyaron .output_capture import captured_output
99from cyaron .graders .mismatch import *
1010from cyaron .compare import CompareMismatch
@@ -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"{ escape_path ( sys .executable ) } correct.py" ,
87+ f"{ escape_path ( 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'{ escape_path ( 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'{ escape_path ( sys .executable ) } correct.py: Correct \n { escape_path ( 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"{ escape_path ( sys .executable ) } correct.py" ,
126+ std_program = f"{ escape_path ( 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'{ escape_path ( sys .executable ) } correct.py: Correct'
132132 self .assertEqual (result , correct_out )
133133
134134 def test_concurrent (self ):
0 commit comments