# HG changeset patch # User Augie Fackler # Date 2015-04-12 19:35:57 # Node ID 201823c50610431abdbd532715e9af69af646946 # Parent 09c71e3da7044af8741f3921a25440182fa61ebb run-tests: work around with_hg being bytes or string depending on provenance diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1709,8 +1709,15 @@ class TestRunner(object): if self.options.with_hg: self._installdir = None - self._bindir = os.path.dirname(os.path.realpath( - self.options.with_hg)) + whg = self.options.with_hg + # If --with-hg is not specified, we have bytes already, + # but if it was specified in python3 we get a str, so we + # have to encode it back into a bytes. + if sys.version_info[0] == 3: + if not isinstance(whg, bytes): + whg = whg.encode('utf-8') + self._bindir = os.path.dirname(os.path.realpath(whg)) + assert isinstance(self._bindir, bytes) self._tmpbindir = os.path.join(self._hgtmp, b'install', b'bin') os.makedirs(self._tmpbindir)