##// END OF EJS Templates
run-tests: extract Popen logic to a single method...
Jun Wu -
r34804:d817bf1f default
parent child Browse files
Show More
@@ -2103,16 +2103,16 b' class TextTestRunner(unittest.TextTestRu'
2103 bisectrepo = self._runner.options.bisect_repo
2103 bisectrepo = self._runner.options.bisect_repo
2104 if bisectrepo:
2104 if bisectrepo:
2105 bisectcmd.extend(['-R', os.path.abspath(bisectrepo)])
2105 bisectcmd.extend(['-R', os.path.abspath(bisectrepo)])
2106 def nooutput(args):
2106 def pread(args):
2107 p = subprocess.Popen(args, stderr=subprocess.STDOUT,
2107 p = subprocess.Popen(args, stderr=subprocess.STDOUT,
2108 stdout=subprocess.PIPE)
2108 stdout=subprocess.PIPE)
2109 p.stdout.read()
2109 data = p.stdout.read()
2110 p.wait()
2110 p.wait()
2111 return data
2111 for test in tests:
2112 for test in tests:
2112 nooutput(bisectcmd + ['--reset']),
2113 pread(bisectcmd + ['--reset']),
2113 nooutput(bisectcmd + ['--bad', '.'])
2114 pread(bisectcmd + ['--bad', '.'])
2114 nooutput(bisectcmd + ['--good',
2115 pread(bisectcmd + ['--good', self._runner.options.known_good_rev])
2115 self._runner.options.known_good_rev])
2116 # TODO: we probably need to forward more options
2116 # TODO: we probably need to forward more options
2117 # that alter hg's behavior inside the tests.
2117 # that alter hg's behavior inside the tests.
2118 opts = ''
2118 opts = ''
@@ -2121,11 +2121,7 b' class TextTestRunner(unittest.TextTestRu'
2121 opts += ' --with-hg=%s ' % shellquote(_strpath(withhg))
2121 opts += ' --with-hg=%s ' % shellquote(_strpath(withhg))
2122 rtc = '%s %s %s %s' % (sys.executable, sys.argv[0], opts,
2122 rtc = '%s %s %s %s' % (sys.executable, sys.argv[0], opts,
2123 test)
2123 test)
2124 sub = subprocess.Popen(bisectcmd + ['--command', rtc],
2124 data = pread(bisectcmd + ['--command', rtc])
2125 stderr=subprocess.STDOUT,
2126 stdout=subprocess.PIPE)
2127 data = sub.stdout.read()
2128 sub.wait()
2129 m = re.search(
2125 m = re.search(
2130 (br'\nThe first (?P<goodbad>bad|good) revision '
2126 (br'\nThe first (?P<goodbad>bad|good) revision '
2131 br'is:\nchangeset: +\d+:(?P<node>[a-f0-9]+)\n.*\n'
2127 br'is:\nchangeset: +\d+:(?P<node>[a-f0-9]+)\n.*\n'
General Comments 0
You need to be logged in to leave comments. Login now