From: david-sarah Date: Sun, 8 Aug 2010 04:28:17 +0000 (-0700) Subject: test_runner.py: calculate the location of bin/tahoe correctly for test-from-prefixdir... X-Git-Tag: allmydata-tahoe-1.8.0c2~13 X-Git-Url: https://git.rkrishnan.org/vdrive/frontends/using.html?a=commitdiff_plain;h=39fa9a81d121ce19e2e26ff74d37232abf9b8a2a;p=tahoe-lafs%2Ftahoe-lafs.git 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. --- 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.")