From: david-sarah Date: Sun, 21 Nov 2010 23:39:57 +0000 (-0800) Subject: misc/build_helpers/run_trial.py: allow the module argument to specify a leaf module... X-Git-Url: https://git.rkrishnan.org/simplejson/components/%22file:/?a=commitdiff_plain;h=41e96b3e5a61940113a562b7046d3aa6827e25f5;p=tahoe-lafs%2Ftahoe-lafs.git 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. --- diff --git a/misc/build_helpers/run_trial.py b/misc/build_helpers/run_trial.py index d448a00f..29fce952 100644 --- a/misc/build_helpers/run_trial.py +++ b/misc/build_helpers/run_trial.py @@ -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'):