summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/loader.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-10-23 17:11:29 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-10-23 17:11:29 (GMT)
commit5d791802c925425e75370e88c7d1e68f23b7d724 (patch)
tree0bb1619573a1882f00c4b710c2ddd35edf5fd4a2 /Lib/unittest/loader.py
parent17934856dc76b8cf1667a293445df6aeca225768 (diff)
downloadcpython-5d791802c925425e75370e88c7d1e68f23b7d724.zip
cpython-5d791802c925425e75370e88c7d1e68f23b7d724.tar.gz
cpython-5d791802c925425e75370e88c7d1e68f23b7d724.tar.bz2
Issue #19352: Fix unittest discovery when a module can be reached through several paths (e.g. under Debian/Ubuntu with virtualenv).
Diffstat (limited to 'Lib/unittest/loader.py')
-rw-r--r--Lib/unittest/loader.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py
index c6fc663..9163a1a 100644
--- a/Lib/unittest/loader.py
+++ b/Lib/unittest/loader.py
@@ -256,8 +256,8 @@ class TestLoader(object):
yield _make_failed_import_test(name, self.suiteClass)
else:
mod_file = os.path.abspath(getattr(module, '__file__', full_path))
- realpath = os.path.splitext(mod_file)[0]
- fullpath_noext = os.path.splitext(full_path)[0]
+ realpath = os.path.splitext(os.path.realpath(mod_file))[0]
+ fullpath_noext = os.path.splitext(os.path.realpath(full_path))[0]
if realpath.lower() != fullpath_noext.lower():
module_dir = os.path.dirname(realpath)
mod_name = os.path.splitext(os.path.basename(full_path))[0]