diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-03-24 15:12:20 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-03-24 15:12:20 -0400 |
commit | 7f9d40fe5474a6f59e9a1cf2c52179f77f9a1714 (patch) | |
tree | 5921bf309f131635256e63c062ee8d400f46bfdb /coverage/files.py | |
parent | f143f15d06ca120034c6178036243aa90a4ef8e6 (diff) | |
download | python-coveragepy-git-7f9d40fe5474a6f59e9a1cf2c52179f77f9a1714.tar.gz |
When looking for python files, don't take suspicious ones. Fixes #168.
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 5 |
1 files changed, 4 insertions, 1 deletions
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) |