misc/build_helpers/run_trial.py: allow the module argument to specify a leaf module rather than a directory. This fixes false positive wrong-source errors in the test-from-prefixdir step when we test only allmydata.test.test_runner.

This commit is contained in:
david-sarah 2010-11-21 15:39:57 -08:00
parent 4c06ea4a72
commit 41e96b3e5a

View File

@ -52,7 +52,14 @@ if modulename is None:
__import__(modulename)
srcfile = sys.modules[modulename].__file__
srcdir = os.path.dirname(os.path.realpath(srcfile))
for i in modulename.split('.'):
components = modulename.split('.')
leaf = os.path.normcase(components[-1])
if os.path.normcase(os.path.basename(srcfile)) in (leaf + '.py', leaf + '.pyc'):
# strip the leaf module name
components = components[:-1]
for i in components:
srcdir = os.path.dirname(srcdir)
if os.path.normcase(srcdir).endswith('.egg'):