@@ -148,6 +148,7 @@ def escape(txt: str) -> str:
148
148
def load_test (filename : Path , verbose : bool = False ) -> Dict :
149
149
if verbose :
150
150
print (f"Loading { filename } ..." )
151
+ expr_b = filename .read_bytes ()
151
152
expr = filename .read_text (encoding = 'utf-8' )
152
153
try :
153
154
d = eval (expr )
@@ -192,8 +193,8 @@ def clean_tests():
192
193
def list_tests (root_path : Path , verbose : bool = False ):
193
194
for t in tests :
194
195
test_file : Path = root_path / (t .id .replace ('.' , '/' ) + '.py' )
195
- if not test_file .name . startswith ( 'test_ ' ):
196
- test_file = test_file .with_name ('test_' + test_file . name )
196
+ if not test_file .stem . endswith ( '_test ' ):
197
+ test_file = test_file .with_name (test_file . stem + '_test.py' )
197
198
if verbose :
198
199
print (f"id: { t .id } " )
199
200
print (f"output: { test_file } " )
@@ -213,8 +214,14 @@ def write_tests(root_path: Path, verbose: bool=False):
213
214
test_dir = test_file .parent
214
215
if not test_dir .is_dir ():
215
216
make_dirs (root_path , test_dir )
216
- if not test_file .name .startswith ('test_' ):
217
- test_file = test_file .with_name ('test_' + test_file .name )
217
+ if test_file .name .startswith ('core_' ):
218
+ if not test_file .stem .endswith ('_test' ):
219
+ test_file = test_file .with_name (test_file .stem + '_test.py' )
220
+ else :
221
+ if not test_file .name .startswith ('test_' ):
222
+ test_file = test_file .with_name ('test_' + test_file .name )
223
+ if test_file .stem [0 ] in '0123456789' :
224
+ test_file = test_file .with_name ('t' + test_file .name )
218
225
content = f"""#coding:utf-8
219
226
#
220
227
# id: { t .id }
@@ -277,7 +284,7 @@ def write_tests(root_path: Path, verbose: bool=False):
277
284
content += f"""@pytest.mark.platform({ ", " .join ([f"'{ i } '" for i in v .platform .split (':' )])} )\n """
278
285
if v .id in slow_tests :
279
286
content += '@pytest.mark.slow\n '
280
- content += f"""def { test_file . stem } _ { seq } (act_{ seq } : Action):\n """
287
+ content += f"""def test_ { seq } (act_{ seq } : Action):\n """
281
288
if v .expected_stdout :
282
289
content += f' act_{ seq } .expected_stdout = expected_stdout_{ seq } \n '
283
290
if v .expected_stderr :
@@ -303,7 +310,7 @@ def write_tests(root_path: Path, verbose: bool=False):
303
310
if v .platform != 'All' :
304
311
content += f"""@pytest.mark.platform({ ", " .join ([f"'{ i } '" for i in v .platform .split (':' )])} )\n """
305
312
content += "@pytest.mark.xfail\n "
306
- content += f"""def { test_file . stem } _ { seq } (db_{ seq } ):\n pytest.fail("Test not IMPLEMENTED")\n \n """
313
+ content += f"""def test_ { seq } (db_{ seq } ):\n pytest.fail("Test not IMPLEMENTED")\n \n """
307
314
content += '\n '
308
315
309
316
#
0 commit comments