From b63ef8bc31b64a055c13ba2fc924059a5fa58701 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 4 Jan 2020 08:51:31 -0500 Subject: [PATCH] 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 3bc7e54e4..8badf4f77 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -479,6 +479,10 @@ def warn_already_imported_files(self): 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.has_dynamic_filename: # A plugin with dynamic filenames: the Python file