diff options
author | John Szakmeister <john@szakmeister.net> | 2014-04-20 08:05:44 -0400 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2014-04-20 08:05:44 -0400 |
commit | de009bb07544b99fd8cab2328eca4970e6d1f1d9 (patch) | |
tree | 02759bc46013b3bafcc49fb2039ee9c976b1d3be | |
parent | a0835939c02f2081351cb7219053d27d9224bca4 (diff) | |
download | nose-de009bb07544b99fd8cab2328eca4970e6d1f1d9.tar.gz |
Fix #792: "Not a directory" error when using python setup.py nosetests
The issue is that egg files can end up on our search path, and we treat
all paths as though they are directories. Instead, we'll do an explicit
check that it is a directory before attempting to load tests from it.
-rw-r--r-- | nose/loader.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nose/loader.py b/nose/loader.py index 8a85515..966b6dc 100644 --- a/nose/loader.py +++ b/nose/loader.py @@ -344,7 +344,10 @@ class TestLoader(unittest.TestLoader): path, module_path, os.path.realpath(module_path)) if (self.config.traverseNamespace or not path) or \ os.path.realpath(module_path).startswith(path): - tests.extend(self.loadTestsFromDir(module_path)) + # Egg files can be on sys.path, so make sure the path is a + # directory before trying to load from it. + if os.path.isdir(module_path): + tests.extend(self.loadTestsFromDir(module_path)) for test in self.config.plugins.loadTestsFromModule(module, path): tests.append(test) |