Skip to content

Commit 6281cb3

Browse files
committed
remove rename_file and unrename_file
1 parent a347611 commit 6281cb3

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

Diff for: tests/test_flake8_async.py

+4-16
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,11 @@
3535
AUTOFIX_DIR = Path(__file__).parent / "autofix_files"
3636

3737

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-
4938
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()
5240
)
5341
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"
5543
}
5644
# check that there's an eval file for each autofix file
5745
extra_autofix_files = set(autofix_files.keys()) - {f[0] for f in test_files}
@@ -144,9 +132,9 @@ def check_autofix(
144132

145133
# file contains a previous diff showing what's added/removed by the autofixer
146134
# 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"
148136
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"
150138
# if generate_autofix is set, the diff content isn't used and the file
151139
# content will be created
152140
autofix_diff_content = ""

0 commit comments

Comments
 (0)