From d90c675f62a6ffdb7c4f92edb23b3d2e52a7f6fa Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 4 Jan 2020 08:51:31 -0500 Subject: Ignore namespace packages in the already-imported check. #888 --- coverage/inorout.py | 4 ++++ 1 file changed, 4 insertions(+) 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) -- cgit v1.2.1