|
35 | 35 | AUTOFIX_DIR = Path(__file__).parent / "autofix_files"
|
36 | 36 |
|
37 | 37 |
|
38 |
| -# to be able to usefully view diffs on github+be able to run tests in each step |
39 |
| -# we temporarily introduce these functions |
40 |
| -# so we can do the *actual* renaming of files in a separate commit. |
41 |
| -def rename_file(s: str) -> str: |
42 |
| - return re.sub("TRIO", "ASYNC", s) |
43 |
| - |
44 |
| - |
45 |
| -def unrename_file(s: str) -> str: |
46 |
| - return re.sub("ASYNC", "TRIO", s) |
47 |
| - |
48 |
| - |
49 | 38 | test_files: list[tuple[str, Path]] = sorted(
|
50 |
| - (rename_file(f.stem.upper()), f) |
51 |
| - for f in (Path(__file__).parent / "eval_files").iterdir() |
| 39 | + (f.stem.upper(), f) for f in (Path(__file__).parent / "eval_files").iterdir() |
52 | 40 | )
|
53 | 41 | autofix_files: dict[str, Path] = {
|
54 |
| - rename_file(f.stem.upper()): f for f in AUTOFIX_DIR.iterdir() if f.suffix == ".py" |
| 42 | + f.stem.upper(): f for f in AUTOFIX_DIR.iterdir() if f.suffix == ".py" |
55 | 43 | }
|
56 | 44 | # check that there's an eval file for each autofix file
|
57 | 45 | extra_autofix_files = set(autofix_files.keys()) - {f[0] for f in test_files}
|
@@ -144,9 +132,9 @@ def check_autofix(
|
144 | 132 |
|
145 | 133 | # file contains a previous diff showing what's added/removed by the autofixer
|
146 | 134 | # i.e. a diff between "eval_files/{test}.py" and "autofix_files/{test}.py"
|
147 |
| - autofix_diff_file = AUTOFIX_DIR / f"{unrename_file(test).lower()}.py.diff" |
| 135 | + autofix_diff_file = AUTOFIX_DIR / f"{test.lower()}.py.diff" |
148 | 136 | if not autofix_diff_file.exists():
|
149 |
| - assert generate_autofix, "autofix diff file doesn't exist" |
| 137 | + assert generate_autofix, f"autofix diff file {autofix_diff_file} doesn't exist" |
150 | 138 | # if generate_autofix is set, the diff content isn't used and the file
|
151 | 139 | # content will be created
|
152 | 140 | autofix_diff_content = ""
|
|
0 commit comments