summaryrefslogtreecommitdiff
path: root/nose/importer.py
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2008-03-26 01:51:08 +0000
committerJason Pellerin <jpellerin@gmail.com>2008-03-26 01:51:08 +0000
commitb570a203b505ecc3e2e35c3be2f80f2ccf7be607 (patch)
tree2b87539adf2a3cf28ceae8582fee310867b7f3e2 /nose/importer.py
parentca416434c823cdd21b01efa6e6049fe7009d5451 (diff)
downloadnose-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.py23
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):