summaryrefslogtreecommitdiff
path: root/CoverageTestRunner.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2013-09-27 18:35:15 +0100
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2013-09-27 18:35:15 +0100
commit0a3b1a065257109295f9322f5a7e199d157acfe6 (patch)
tree8f7a25d69fe3728d23bfe7b5bbaef0957bbf3184 /CoverageTestRunner.py
parentd7b5706244fca58d8a2564ba6394cb460d2ca2c6 (diff)
downloadcoverage-test-runner-0a3b1a065257109295f9322f5a7e199d157acfe6.tar.gz
Fix importing submodules with the same basenames
This patch fixes a bug in CoverageTestRunner.py, where submodules with the same basenames were not loaded into separate module objects. Because the module names passed to imp.load_module() were the same, previously loaded modules would be reloaded in place, causing different problems: 1. Imports of the affected modules in the test and tested code would sometimes import a different module and cause AttributeError exceptions when expected symbols were not present in the imported module. 2. Sometimes, all but one of the imported modules would incorrectly be considered to have zero test coverage.
Diffstat (limited to 'CoverageTestRunner.py')
-rw-r--r--CoverageTestRunner.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/CoverageTestRunner.py b/CoverageTestRunner.py
index 88987a1..6500041 100644
--- a/CoverageTestRunner.py
+++ b/CoverageTestRunner.py
@@ -158,7 +158,7 @@ class CoverageTestRunner:
for tuple in imp.get_suffixes():
suffix, mode, type = tuple
if pathname.endswith(suffix):
- name = os.path.basename(pathname[:-len(suffix)])
+ name = pathname[:-len(suffix)]
f = file(pathname, mode)
return imp.load_module(name, f, pathname, tuple)
raise Exception("Unknown module: %s" % pathname)