FIX Fixes test for checking gitignore and Cython templates
@@ -10,11 +10,11 @@ def test_files_generated_by_templates_are_git_ignored():
pytest.skip("Tests are not run from the source folder")
base_dir = pathlib.Path(sklearn.__file__).parent
- ignored_files = open(gitignore_file, "r").readlines()
- ignored_files = list(map(lambda line: line.strip("\n"), ignored_files))
+ ignored_files = gitignore_file.read_text().split("\n")
+ ignored_files = [pathlib.Path(line) for line in ignored_files]
for filename in base_dir.glob("**/*.tp"):
filename = filename.relative_to(base_dir.parent)
# From "path/to/template.p??.tp" to "path/to/template.p??"
filename_wo_tempita_suffix = filename.with_suffix("")
- assert str(filename_wo_tempita_suffix) in ignored_files
+ assert filename_wo_tempita_suffix in ignored_files
