Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 26 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,32 @@ def create_files(files, srcdir, code):
path = os.path.join(ext_path, filename)
self.assertNotIn(path, out)

def test_cli_make_exclude(self):
code = dedent("""
/*[clinic input]
[clinic start generated code]*/
""")
with os_helper.temp_dir() as tmp_dir:
# add some folders, some C files and a Python file
for fn in "file1.c", "file2.c", "file3.c":
path = os.path.join(tmp_dir, fn)
with open(path, "w", encoding="utf-8") as f:
f.write(code)

# Run clinic in verbose mode with --make on tmpdir.
# Exclude file2.c and file3.c.
out = self.expect_success(
"-v", "--make", "--srcdir", tmp_dir,
"--exclude", os.path.join(tmp_dir, "file2.c"),
# The added ./ should be normalised away.
"--exclude", os.path.join("./", tmp_dir, "file3.c"),
)

# expect verbose mode to only mention the C files in tmp_dir
self.assertIn("file1.c", out)
self.assertNotIn("file2.c", out)
self.assertNotIn("file3.c", out)

def test_cli_verbose(self):
with os_helper.temp_dir() as tmp_dir:
fn = os.path.join(tmp_dir, "test.c")
Expand Down
1 change: 0 additions & 1 deletion Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5922,7 +5922,6 @@ def run_clinic(parser: argparse.ArgumentParser, ns: argparse.Namespace) -> None:
path = os.path.join(root, filename)
path = os.path.normpath(path)
if path in excludes:
print("Excluding", path)
continue
if ns.verbose:
print(path)
Expand Down