diff options
author | Jason Pellerin <jpellerin@gmail.com> | 2008-03-26 01:51:08 +0000 |
---|---|---|
committer | Jason Pellerin <jpellerin@gmail.com> | 2008-03-26 01:51:08 +0000 |
commit | b570a203b505ecc3e2e35c3be2f80f2ccf7be607 (patch) | |
tree | 2b87539adf2a3cf28ceae8582fee310867b7f3e2 /nose/importer.py | |
parent | ca416434c823cdd21b01efa6e6049fe7009d5451 (diff) | |
download | nose-b570a203b505ecc3e2e35c3be2f80f2ccf7be607.tar.gz |
Applied patch from issue 164, updated CHANGELOG: fixed import of namespace packages.
Diffstat (limited to 'nose/importer.py')
-rw-r--r-- | nose/importer.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/nose/importer.py b/nose/importer.py index 0a6d315..d0c9156 100644 --- a/nose/importer.py +++ b/nose/importer.py @@ -94,23 +94,28 @@ class Importer(object): return mod def sameModule(self, mod, filename): + mod_paths = [] if hasattr(mod, '__path__'): - mod_path = os.path.dirname( - os.path.normpath( - os.path.abspath(mod.__path__[0]))) + for path in mod.__path__: + mod_paths.append(os.path.dirname( + os.path.normpath( + os.path.abspath(path)))) elif hasattr(mod, '__file__'): - mod_path = os.path.dirname( + mod_paths.append(os.path.dirname( os.path.normpath( - os.path.abspath(mod.__file__))) + os.path.abspath(mod.__file__)))) else: # builtin or other module-like object that # doesn't have __file__; must be new return False new_path = os.path.dirname(os.path.normpath(filename)) - log.debug( - "module already loaded? mod: %s new: %s", - mod_path, new_path) - return mod_path == new_path + for mod_path in mod_paths: + log.debug( + "module already loaded? mod: %s new: %s", + mod_path, new_path) + if mod_path == new_path: + return True + return False def add_path(path, config=None): |