##// END OF EJS Templates
py3: allow run-tests.py to run on Windows...
Matt Harbison -
r39683:543a788e default
parent child Browse files
Show More
@@ -229,7 +229,8 b' def checkportisavailable(port):'
229 closefds = os.name == 'posix'
229 closefds = os.name == 'posix'
230 def Popen4(cmd, wd, timeout, env=None):
230 def Popen4(cmd, wd, timeout, env=None):
231 processlock.acquire()
231 processlock.acquire()
232 p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=wd, env=env,
232 p = subprocess.Popen(_strpath(cmd), shell=True, bufsize=-1,
233 cwd=_strpath(wd), env=env,
233 close_fds=closefds,
234 close_fds=closefds,
234 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
235 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
235 stderr=subprocess.STDOUT)
236 stderr=subprocess.STDOUT)
@@ -988,7 +989,7 b' class Test(unittest.TestCase):'
988 return (
989 return (
989 (b''.join(c.isalpha() and b'[%s%s]' % (c.lower(), c.upper()) or
990 (b''.join(c.isalpha() and b'[%s%s]' % (c.lower(), c.upper()) or
990 c in b'/\\' and br'[/\\]' or c.isdigit() and c or b'\\' + c
991 c in b'/\\' and br'[/\\]' or c.isdigit() and c or b'\\' + c
991 for c in p))
992 for c in [p[i:i + 1] for i in range(len(p))]))
992 )
993 )
993 else:
994 else:
994 return re.escape(p)
995 return re.escape(p)
@@ -1137,7 +1138,8 b' class Test(unittest.TestCase):'
1137 Return a tuple (exitcode, output). output is None in debug mode.
1138 Return a tuple (exitcode, output). output is None in debug mode.
1138 """
1139 """
1139 if self._debug:
1140 if self._debug:
1140 proc = subprocess.Popen(cmd, shell=True, cwd=self._testtmp,
1141 proc = subprocess.Popen(_strpath(cmd), shell=True,
1142 cwd=_strpath(self._testtmp),
1141 env=env)
1143 env=env)
1142 ret = proc.wait()
1144 ret = proc.wait()
1143 return (ret, None)
1145 return (ret, None)
@@ -1817,10 +1819,8 b' class TestResult(unittest._TextTestResul'
1817 pass
1819 pass
1818 elif self._options.view:
1820 elif self._options.view:
1819 v = self._options.view
1821 v = self._options.view
1820 if PYTHON3:
1822 os.system(r"%s %s %s" %
1821 v = _bytespath(v)
1823 (v, _strpath(test.refpath), _strpath(test.errpath)))
1822 os.system(b"%s %s %s" %
1823 (v, test.refpath, test.errpath))
1824 else:
1824 else:
1825 servefail, lines = getdiff(expected, got,
1825 servefail, lines = getdiff(expected, got,
1826 test.refpath, test.errpath)
1826 test.refpath, test.errpath)
@@ -2888,7 +2888,10 b' class TestRunner(object):'
2888 """Configure the environment to use the appropriate Python in tests."""
2888 """Configure the environment to use the appropriate Python in tests."""
2889 # Tests must use the same interpreter as us or bad things will happen.
2889 # Tests must use the same interpreter as us or bad things will happen.
2890 pyexename = sys.platform == 'win32' and b'python.exe' or b'python'
2890 pyexename = sys.platform == 'win32' and b'python.exe' or b'python'
2891 if getattr(os, 'symlink', None):
2891
2892 # os.symlink() is a thing with py3 on Windows, but it requires
2893 # Administrator rights.
2894 if getattr(os, 'symlink', None) and os.name != 'nt':
2892 vlog("# Making python executable in test path a symlink to '%s'" %
2895 vlog("# Making python executable in test path a symlink to '%s'" %
2893 sys.executable)
2896 sys.executable)
2894 mypython = os.path.join(self._tmpbindir, pyexename)
2897 mypython = os.path.join(self._tmpbindir, pyexename)
General Comments 0
You need to be logged in to leave comments. Login now