|
7 | 7 |
|
8 | 8 | from cedarscript_editor import find_commands, CEDARScriptEditor |
9 | 9 |
|
| 10 | +_no_windows = '!nowindows' |
10 | 11 |
|
11 | 12 | def get_test_cases() -> list[str]: |
12 | 13 | """Get all test cases from tests/corpus directory. |
@@ -41,9 +42,8 @@ def editor(tmp_path_factory): |
41 | 42 | @pytest.mark.parametrize('test_case', get_test_cases()) |
42 | 43 | def test_corpus(editor: CEDARScriptEditor, test_case: str): |
43 | 44 | """Test CEDARScript commands from chat.xml files in corpus.""" |
44 | | - if test_case.casefold().endswith('!nowindows'): |
45 | | - if sys.platform == 'win32': |
46 | | - pytest.skip(f"Cannot run under Windows: {test_case.removesuffix('!nowindows')}") |
| 45 | + if test_case.casefold().endswith(_no_windows) and sys.platform == 'win32': |
| 46 | + pytest.skip(f"Cannot run under Windows: {test_case.removesuffix(_no_windows)}") |
47 | 47 |
|
48 | 48 | try: |
49 | 49 | corpus_dir = Path(__file__).parent / 'corpus' |
@@ -95,10 +95,10 @@ def check_expected_files(dir_path: Path): |
95 | 95 | continue |
96 | 96 | # Find corresponding expected file in test directory |
97 | 97 | rel_path = path.relative_to(editor.root_path) |
98 | | - if str(rel_path).startswith("."): |
| 98 | + if str(rel_path).startswith(".") or str(rel_path).endswith("~"): |
99 | 99 | continue |
100 | 100 | expected_file = test_dir / f"expected.{rel_path}" |
101 | | - assert expected_file.exists(), f"'expected.*' file not found: {expected_file}" |
| 101 | + assert expected_file.exists(), f"'expected.*' file not found: '{expected_file}'" |
102 | 102 |
|
103 | 103 | expected_content = file_to_lines(expected_file, rel_path) |
104 | 104 | actual_content = file_to_lines(path, rel_path) |
|
0 commit comments