diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-05-03 22:09:27 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-05-03 22:09:27 -0400 |
commit | b48ec04376ae5c9103bb73e1146473d70c1e5c8e (patch) | |
tree | 3c2ee5a25c254d3b735a64b915440b079c541360 /coverage/python.py | |
parent | 1b6d50b5cfa1a1319b2ab726111cd6e961a3926c (diff) | |
download | python-coveragepy-git-b48ec04376ae5c9103bb73e1146473d70c1e5c8e.tar.gz |
Use correct name for package source files. #526
Diffstat (limited to 'coverage/python.py')
-rw-r--r-- | coverage/python.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/coverage/python.py b/coverage/python.py index dacdf619..10d22e08 100644 --- a/coverage/python.py +++ b/coverage/python.py @@ -150,11 +150,10 @@ class PythonFileReporter(FileReporter): super(PythonFileReporter, self).__init__(files.canonical_filename(filename)) if hasattr(morf, '__name__'): - name = morf.__name__ - name = name.replace(".", os.sep) - if filename.endswith('__init__.py'): - name += os.sep + '__init__' - name += '.py' + name = morf.__name__.replace(".", os.sep) + if os.path.basename(filename).startswith('__init__.'): + name += os.sep + "__init__" + name += ".py" name = files.unicode_filename(name) else: name = files.relative_filename(filename) |