From 7f9d40fe5474a6f59e9a1cf2c52179f77f9a1714 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 24 Mar 2012 15:12:20 -0400 Subject: When looking for python files, don't take suspicious ones. Fixes #168. --- coverage/files.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'coverage/files.py') diff --git a/coverage/files.py b/coverage/files.py index 81ec196f..e6dc4aa1 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -215,5 +215,8 @@ def find_python_files(dirname): del dirnames[:] continue for filename in filenames: - if fnmatch.fnmatch(filename, "*.py"): + # We're only interested in files that look like reasonable Python + # files: Must end with .py, and must not have certain funny + # characters that probably mean they are editor junk. + if re.match(r"^[^.#~!$@%^&*()+=,]+\.py$", filename): yield os.path.join(dirpath, filename) -- cgit v1.2.1