Skip to content

FIX Fixes test for checking gitignore and Cython templates #20997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sklearn/utils/tests/test_cython_templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -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