From 39fa9a81d121ce19e2e26ff74d37232abf9b8a2a Mon Sep 17 00:00:00 2001 From: david-sarah Date: Sat, 7 Aug 2010 21:28:17 -0700 Subject: [PATCH] test_runner.py: calculate the location of bin/tahoe correctly for test-from-prefixdir (by copying code from misc/build_helpers/run_trial.py). Also fix the false-positive check for Unicode paths in test_the_right_code, which was causing skips that should have been failures. --- src/allmydata/test/test_runner.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py index 61dea9cd..373cafbd 100644 --- a/src/allmydata/test/test_runner.py +++ b/src/allmydata/test/test_runner.py @@ -17,11 +17,24 @@ timeout = 240 srcfile = allmydata.__file__ srcdir = os.path.dirname(os.path.dirname(os.path.realpath(srcfile))) +if os.path.normcase(srcdir).endswith('.egg'): + srcdir = os.path.dirname(srcdir) +elif os.path.normcase(os.path.basename(srcdir)) == 'site-packages': + srcdir = os.path.dirname(srcdir) + if re.search(r'python.+\..+', os.path.normcase(os.path.basename(srcdir))): + srcdir = os.path.dirname(srcdir) + if os.path.normcase(os.path.basename(srcdir)) == 'lib': + srcdir = os.path.dirname(srcdir) + rootdir = os.path.dirname(srcdir) bintahoe = os.path.join(rootdir, 'bin', 'tahoe') if sys.platform == "win32": bintahoe += ".pyscript" + if not os.path.exists(bintahoe): + alt_bintahoe = os.path.join(rootdir, 'Scripts', 'tahoe.pyscript') + if os.path.exists(alt_bintahoe): + bintahoe = alt_bintahoe class SkipMixin: @@ -57,7 +70,8 @@ class BinTahoe(common_util.SignalMixin, unittest.TestCase, SkipMixin): "but expected to be testing the code at %r.\n" % (root_from_test, srcfile, root_from_cwd)) if (not isinstance(cwd, unicode) and - cwd.decode(get_filesystem_encoding(), 'replace') != os.path.normcase(os.path.normpath(os.getcwdu()))): + (os.path.normcase(os.path.normpath(cwd))).decode(get_filesystem_encoding(), 'replace') + != os.path.normcase(os.path.normpath(os.getcwdu()))): msg += ("However, this may be a false alarm because the current directory path\n" "is not representable in the filesystem encoding. Please run the tests\n" "from the root of the Tahoe-LAFS distribution at a non-Unicode path.") -- 2.45.2