From 41e96b3e5a61940113a562b7046d3aa6827e25f5 Mon Sep 17 00:00:00 2001 From: david-sarah Date: Sun, 21 Nov 2010 15:39:57 -0800 Subject: [PATCH] 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. --- misc/build_helpers/run_trial.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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'): -- 2.45.2