From 87ec3e1bb7489b52007694743181408bdfdde96b Mon Sep 17 00:00:00 2001 From: Gabor Kertesz Date: Thu, 9 Sep 2021 17:09:16 +0200 Subject: [PATCH] FIX TST Fix for #20996 Converting to string removed the windows compatible path. --- sklearn/utils/tests/test_cython_templating.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sklearn/utils/tests/test_cython_templating.py b/sklearn/utils/tests/test_cython_templating.py index 572d1db523cf8..eeb8319e07415 100644 --- a/sklearn/utils/tests/test_cython_templating.py +++ b/sklearn/utils/tests/test_cython_templating.py @@ -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