From a4dd588f1f8393887823d2ea14baba981a7aebc0 Mon Sep 17 00:00:00 2001 From: greyfenrir Date: Sun, 19 Jul 2020 12:49:34 +0300 Subject: [PATCH] fix test methods names gathering non-symmetric path manipulations (normcase(realpath()) vs realpath(normcase)) caused problem with finding tests on Windows and must be unified. fix for issue #1106 --- nose/loader.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nose/loader.py b/nose/loader.py index a5793726..69958309 100644 --- a/nose/loader.py +++ b/nose/loader.py @@ -344,12 +344,10 @@ def loadTestsFromModule(self, module, path=None, discovered=False): for module_path in module_paths: log.debug("Load tests from module path %s?", module_path) + realpath = os.path.normcase(os.path.realpath(module_path)) log.debug("path: %s os.path.realpath(%s): %s", - path, os.path.normcase(module_path), - os.path.realpath(os.path.normcase(module_path))) - if (self.config.traverseNamespace or not path) or \ - os.path.realpath( - os.path.normcase(module_path)).startswith(path): + path, os.path.normcase(module_path), realpath) + if (self.config.traverseNamespace or not path) or realpath.startswith(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):