Skip to content

Commit e936600

Browse files
committed
Change name scheme for tests
1 parent 9ec943f commit e936600

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

firebird/qa/fbtconv.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def escape(txt: str) -> str:
148148
def load_test(filename: Path, verbose: bool=False) -> Dict:
149149
if verbose:
150150
print(f"Loading {filename}...")
151+
expr_b = filename.read_bytes()
151152
expr = filename.read_text(encoding='utf-8')
152153
try:
153154
d = eval(expr)
@@ -192,8 +193,8 @@ def clean_tests():
192193
def list_tests(root_path: Path, verbose: bool=False):
193194
for t in tests:
194195
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')
197198
if verbose:
198199
print(f"id: {t.id}")
199200
print(f"output: {test_file}")
@@ -213,8 +214,14 @@ def write_tests(root_path: Path, verbose: bool=False):
213214
test_dir = test_file.parent
214215
if not test_dir.is_dir():
215216
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)
218225
content = f"""#coding:utf-8
219226
#
220227
# id: {t.id}
@@ -277,7 +284,7 @@ def write_tests(root_path: Path, verbose: bool=False):
277284
content += f"""@pytest.mark.platform({", ".join([f"'{i}'" for i in v.platform.split(':')])})\n"""
278285
if v.id in slow_tests:
279286
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"""
281288
if v.expected_stdout:
282289
content += f' act_{seq}.expected_stdout = expected_stdout_{seq}\n'
283290
if v.expected_stderr:
@@ -303,7 +310,7 @@ def write_tests(root_path: Path, verbose: bool=False):
303310
if v.platform != 'All':
304311
content += f"""@pytest.mark.platform({", ".join([f"'{i}'" for i in v.platform.split(':')])})\n"""
305312
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"""
307314
content += '\n'
308315

309316
#

0 commit comments

Comments
 (0)