Skip to content

Commit f33fb0a

Browse files
authored
FIX Fixes test for checking gitignore and Cython templates (#20997)
1 parent 28567a5 commit f33fb0a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sklearn/utils/tests/test_cython_templating.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ def test_files_generated_by_templates_are_git_ignored():
1010
pytest.skip("Tests are not run from the source folder")
1111

1212
base_dir = pathlib.Path(sklearn.__file__).parent
13-
ignored_files = open(gitignore_file, "r").readlines()
14-
ignored_files = list(map(lambda line: line.strip("\n"), ignored_files))
13+
ignored_files = gitignore_file.read_text().split("\n")
14+
ignored_files = [pathlib.Path(line) for line in ignored_files]
1515

1616
for filename in base_dir.glob("**/*.tp"):
1717
filename = filename.relative_to(base_dir.parent)
1818
# From "path/to/template.p??.tp" to "path/to/template.p??"
1919
filename_wo_tempita_suffix = filename.with_suffix("")
20-
assert str(filename_wo_tempita_suffix) in ignored_files
20+
assert filename_wo_tempita_suffix in ignored_files

0 commit comments

Comments
 (0)