# HG changeset patch # User Augie Fackler # Date 1429020889 14400 # Node ID caa2043cc322d506a369f542566aaf370f0f80be # Parent cf49cf074ec2b10ab29cd0fef3086a692f3f07e2 run-tests: unblock running python tests in python 3 This makes it clear we need to ban os.popen, but we'll do that in a later cleanup. diff -r cf49cf074ec2 -r caa2043cc322 tests/run-tests.py --- a/tests/run-tests.py Mon Apr 13 18:07:40 2015 -0400 +++ b/tests/run-tests.py Tue Apr 14 10:14:49 2015 -0400 @@ -127,7 +127,7 @@ return p -PYTHON = sys.executable.replace('\\', '/') +PYTHON = sys.executable.replace('\\', '/').encode('utf-8') IMPL_PATH = b'PYTHONPATH' if 'java' in sys.platform: IMPL_PATH = b'JYTHONPATH' @@ -809,11 +809,11 @@ @property def refpath(self): - return os.path.join(self._testdir, '%s.out' % self.name) + return os.path.join(self._testdir, b'%s.out' % self.bname) def _run(self, env): - py3kswitch = self._py3kwarnings and ' -3' or '' - cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self.path) + py3kswitch = self._py3kwarnings and b' -3' or b'' + cmd = b'%s%s "%s"' % (PYTHON, py3kswitch, self.path) vlog("# Running", cmd) normalizenewlines = os.name == 'nt' result = self._runcommand(cmd, env, @@ -971,7 +971,7 @@ # We've just entered a Python block. Add the header. inpython = True addsalt(prepos, False) # Make sure we report the exit code. - script.append('%s -m heredoctest < 2: + cmd = cmd.decode('utf-8') + pipe = os.popen(cmd) try: self._hgpath = pipe.read().strip() if sys.version_info[0] == 3: