From 0166806295cdfcc525534d25e331e1f9852cbd5f Mon Sep 17 00:00:00 2001 From: Buck Golemon Date: Fri, 14 Nov 2014 16:33:41 -0800 Subject: they changed the way __loader__ looks in 3.3 --- coverage/control.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'coverage/control.py') diff --git a/coverage/control.py b/coverage/control.py index 47e5b50..7a85103 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -322,9 +322,14 @@ class Coverage(object): return dunder_name loader = module_namespace.get('__loader__', None) - if hasattr(loader, 'fullname') and isinstance(loader.fullname, str): - # module loaded via runpy -m - return loader.fullname + for attrname in ('fullname', 'name'): # attribute renamed in py3.2 + if ( + hasattr(loader, 'fullname') and + isinstance(loader.fullname, str) and + loader.fullname != '__main__' + ): + # module loaded via runpy -m + return loader.fullname # script as first argument to python cli inspectedname = inspect.getmodulename(filename) -- cgit v1.2.1