summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-01-04 08:51:31 -0500
committerNed Batchelder <ned@nedbatchelder.com>2020-01-04 08:51:31 -0500
commitd90c675f62a6ffdb7c4f92edb23b3d2e52a7f6fa (patch)
tree2ffdf99d3b39fa74a4c45fe5d73226258994b938
parentacf063cfff09d26678709ce6894d605f4199db09 (diff)
downloadpython-coveragepy-git-nedbat/bug888.tar.gz
Ignore namespace packages in the already-imported check. #888nedbat/bug888
-rw-r--r--coverage/inorout.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/coverage/inorout.py b/coverage/inorout.py
index d5e8b226..17e11b64 100644
--- a/coverage/inorout.py
+++ b/coverage/inorout.py
@@ -359,6 +359,10 @@ class InOrOut(object):
if filename in warned:
continue
+ if len(getattr(mod, "__path__", ())) > 1:
+ # A namespace package, which confuses this code, so ignore it.
+ continue
+
disp = self.should_trace(filename)
if disp.trace:
msg = "Already imported a file that will be measured: {}".format(filename)