Show More
@@ -362,18 +362,10 b' def canonpath(path):' | |||||
362 |
|
362 | |||
363 |
|
363 | |||
364 | def which(exe): |
|
364 | def which(exe): | |
365 | if PYTHON3: |
|
365 | # shutil.which only accept bytes from 3.8 | |
366 | # shutil.which only accept bytes from 3.8 |
|
366 | cmd = _bytes2sys(exe) | |
367 | cmd = _bytes2sys(exe) |
|
367 | real_exec = shutil.which(cmd) | |
368 | real_exec = shutil.which(cmd) |
|
368 | return _sys2bytes(real_exec) | |
369 | return _sys2bytes(real_exec) |
|
|||
370 | else: |
|
|||
371 | # let us do the os work |
|
|||
372 | for p in osenvironb[b'PATH'].split(os.pathsep): |
|
|||
373 | f = os.path.join(p, exe) |
|
|||
374 | if os.path.isfile(f): |
|
|||
375 | return f |
|
|||
376 | return None |
|
|||
377 |
|
369 | |||
378 |
|
370 | |||
379 | def parselistfiles(files, listtype, warn=True): |
|
371 | def parselistfiles(files, listtype, warn=True): | |
@@ -1864,11 +1856,8 b' class TTest(Test):' | |||||
1864 | script.append(b'alias pwd="pwd -W"\n') |
|
1856 | script.append(b'alias pwd="pwd -W"\n') | |
1865 |
|
1857 | |||
1866 | if hgcatapult and hgcatapult != os.devnull: |
|
1858 | if hgcatapult and hgcatapult != os.devnull: | |
1867 | if PYTHON3: |
|
1859 | hgcatapult = hgcatapult.encode('utf8') | |
1868 |
|
|
1860 | cataname = self.name.encode('utf8') | |
1869 | cataname = self.name.encode('utf8') |
|
|||
1870 | else: |
|
|||
1871 | cataname = self.name |
|
|||
1872 |
|
1861 | |||
1873 | # Kludge: use a while loop to keep the pipe from getting |
|
1862 | # Kludge: use a while loop to keep the pipe from getting | |
1874 | # closed by our echo commands. The still-running file gets |
|
1863 | # closed by our echo commands. The still-running file gets | |
@@ -2173,11 +2162,8 b' class TTest(Test):' | |||||
2173 | return "retry", False |
|
2162 | return "retry", False | |
2174 |
|
2163 | |||
2175 | if el.endswith(b" (esc)\n"): |
|
2164 | if el.endswith(b" (esc)\n"): | |
2176 | if PYTHON3: |
|
2165 | el = el[:-7].decode('unicode_escape') + '\n' | |
2177 |
|
|
2166 | el = el.encode('latin-1') | |
2178 | el = el.encode('latin-1') |
|
|||
2179 | else: |
|
|||
2180 | el = el[:-7].decode('string-escape') + '\n' |
|
|||
2181 | if el == l or WINDOWS and el[:-1] + b'\r\n' == l: |
|
2167 | if el == l or WINDOWS and el[:-1] + b'\r\n' == l: | |
2182 | return True, True |
|
2168 | return True, True | |
2183 | if el.endswith(b" (re)\n"): |
|
2169 | if el.endswith(b" (re)\n"): | |
@@ -2225,10 +2211,7 b' iolock = threading.RLock()' | |||||
2225 | firstlock = threading.RLock() |
|
2211 | firstlock = threading.RLock() | |
2226 | firsterror = False |
|
2212 | firsterror = False | |
2227 |
|
2213 | |||
2228 | if PYTHON3: |
|
2214 | base_class = unittest.TextTestResult | |
2229 | base_class = unittest.TextTestResult |
|
|||
2230 | else: |
|
|||
2231 | base_class = unittest._TextTestResult |
|
|||
2232 |
|
2215 | |||
2233 |
|
2216 | |||
2234 | class TestResult(base_class): |
|
2217 | class TestResult(base_class): | |
@@ -2352,13 +2335,9 b' class TestResult(base_class):' | |||||
2352 | self.stream.write('\n') |
|
2335 | self.stream.write('\n') | |
2353 | for line in lines: |
|
2336 | for line in lines: | |
2354 | line = highlightdiff(line, self.color) |
|
2337 | line = highlightdiff(line, self.color) | |
2355 |
|
|
2338 | self.stream.flush() | |
2356 |
|
|
2339 | self.stream.buffer.write(line) | |
2357 |
|
|
2340 | self.stream.buffer.flush() | |
2358 | self.stream.buffer.flush() |
|
|||
2359 | else: |
|
|||
2360 | self.stream.write(line) |
|
|||
2361 | self.stream.flush() |
|
|||
2362 |
|
2341 | |||
2363 | if servefail: |
|
2342 | if servefail: | |
2364 | raise test.failureException( |
|
2343 | raise test.failureException( | |
@@ -3247,10 +3226,7 b' class TestRunner(object):' | |||||
3247 | fileb = _sys2bytes(__file__) |
|
3226 | fileb = _sys2bytes(__file__) | |
3248 | runtestdir = os.path.abspath(os.path.dirname(fileb)) |
|
3227 | runtestdir = os.path.abspath(os.path.dirname(fileb)) | |
3249 | osenvironb[b'RUNTESTDIR'] = runtestdir |
|
3228 | osenvironb[b'RUNTESTDIR'] = runtestdir | |
3250 | if PYTHON3: |
|
3229 | sepb = _sys2bytes(os.pathsep) | |
3251 | sepb = _sys2bytes(os.pathsep) |
|
|||
3252 | else: |
|
|||
3253 | sepb = os.pathsep |
|
|||
3254 | path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb) |
|
3230 | path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb) | |
3255 | if os.path.islink(__file__): |
|
3231 | if os.path.islink(__file__): | |
3256 | # test helper will likely be at the end of the symlink |
|
3232 | # test helper will likely be at the end of the symlink | |
@@ -3598,10 +3574,8 b' class TestRunner(object):' | |||||
3598 | pyexe_names = [b'python', b'python3', b'python.exe'] |
|
3574 | pyexe_names = [b'python', b'python3', b'python.exe'] | |
3599 | elif WINDOWS: |
|
3575 | elif WINDOWS: | |
3600 | pyexe_names = [b'python', b'python.exe'] |
|
3576 | pyexe_names = [b'python', b'python.exe'] | |
3601 |
el |
|
3577 | else: | |
3602 | pyexe_names = [b'python', b'python3'] |
|
3578 | pyexe_names = [b'python', b'python3'] | |
3603 | else: |
|
|||
3604 | pyexe_names = [b'python', b'python2'] |
|
|||
3605 |
|
3579 | |||
3606 | # os.symlink() is a thing with py3 on Windows, but it requires |
|
3580 | # os.symlink() is a thing with py3 on Windows, but it requires | |
3607 | # Administrator rights. |
|
3581 | # Administrator rights. | |
@@ -3766,10 +3740,7 b' class TestRunner(object):' | |||||
3766 | else: |
|
3740 | else: | |
3767 | with open(installerrs, 'rb') as f: |
|
3741 | with open(installerrs, 'rb') as f: | |
3768 | for line in f: |
|
3742 | for line in f: | |
3769 | if PYTHON3: |
|
3743 | sys.stdout.buffer.write(line) | |
3770 | sys.stdout.buffer.write(line) |
|
|||
3771 | else: |
|
|||
3772 | sys.stdout.write(line) |
|
|||
3773 | sys.exit(1) |
|
3744 | sys.exit(1) | |
3774 | os.chdir(self._testdir) |
|
3745 | os.chdir(self._testdir) | |
3775 |
|
3746 | |||
@@ -3862,10 +3833,7 b' class TestRunner(object):' | |||||
3862 | ) |
|
3833 | ) | |
3863 | out, _err = proc.communicate() |
|
3834 | out, _err = proc.communicate() | |
3864 | if proc.returncode != 0: |
|
3835 | if proc.returncode != 0: | |
3865 | if PYTHON3: |
|
3836 | sys.stdout.buffer.write(out) | |
3866 | sys.stdout.buffer.write(out) |
|
|||
3867 | else: |
|
|||
3868 | sys.stdout.write(out) |
|
|||
3869 | sys.exit(1) |
|
3837 | sys.exit(1) | |
3870 |
|
3838 | |||
3871 | def _installrhg(self): |
|
3839 | def _installrhg(self): | |
@@ -3889,10 +3857,7 b' class TestRunner(object):' | |||||
3889 | ) |
|
3857 | ) | |
3890 | out, _err = proc.communicate() |
|
3858 | out, _err = proc.communicate() | |
3891 | if proc.returncode != 0: |
|
3859 | if proc.returncode != 0: | |
3892 | if PYTHON3: |
|
3860 | sys.stdout.buffer.write(out) | |
3893 | sys.stdout.buffer.write(out) |
|
|||
3894 | else: |
|
|||
3895 | sys.stdout.write(out) |
|
|||
3896 | sys.exit(1) |
|
3861 | sys.exit(1) | |
3897 |
|
3862 | |||
3898 | def _build_pyoxidized(self): |
|
3863 | def _build_pyoxidized(self): | |
@@ -3920,10 +3885,7 b' class TestRunner(object):' | |||||
3920 | ) |
|
3885 | ) | |
3921 | out, _err = proc.communicate() |
|
3886 | out, _err = proc.communicate() | |
3922 | if proc.returncode != 0: |
|
3887 | if proc.returncode != 0: | |
3923 | if PYTHON3: |
|
3888 | sys.stdout.buffer.write(out) | |
3924 | sys.stdout.buffer.write(out) |
|
|||
3925 | else: |
|
|||
3926 | sys.stdout.write(out) |
|
|||
3927 | sys.exit(1) |
|
3889 | sys.exit(1) | |
3928 |
|
3890 | |||
3929 | def _outputcoverage(self): |
|
3891 | def _outputcoverage(self): |
General Comments 0
You need to be logged in to leave comments.
Login now