run-tests: remove arguments from Test._runcommand
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 28 Mar 2015 14:12:57 -0700
changeset 24509 27092bb70293
parent 24508 fbe2fb71a6e6
child 24510 8d6fd0b8f622
run-tests: remove arguments from Test._runcommand Now that runcommand is part of the Test class, arguments that were previously coming from Test attributes can now be switched to lookups inline.
tests/run-tests.py
--- a/tests/run-tests.py	Sat Mar 28 14:08:25 2015 -0700
+++ b/tests/run-tests.py	Sat Mar 28 14:12:57 2015 -0700
@@ -722,19 +722,19 @@
         # Failed is denoted by AssertionError (by default at least).
         raise AssertionError(msg)
 
-    def _runcommand(self, cmd, wd, replacements, env, debug=False,
-                    timeout=None):
+    def _runcommand(self, cmd, replacements, env):
         """Run command in a sub-process, capturing the output (stdout and
         stderr).
 
         Return a tuple (exitcode, output). output is None in debug mode.
         """
-        if debug:
-            proc = subprocess.Popen(cmd, shell=True, cwd=wd, env=env)
+        if self._debug:
+            proc = subprocess.Popen(cmd, shell=True, cwd=self._testtmp,
+                                    env=env)
             ret = proc.wait()
             return (ret, None)
 
-        proc = Popen4(cmd, wd, timeout, env)
+        proc = Popen4(cmd, self._testtmp, self._timeout, env)
         def cleanup():
             terminate(proc)
             ret = proc.wait()
@@ -780,8 +780,7 @@
         vlog("# Running", cmd)
         if os.name == 'nt':
             replacements.append((r'\r\n', '\n'))
-        result = self._runcommand(cmd, self._testtmp, replacements, env,
-                                  debug=self._debug, timeout=self._timeout)
+        result = self._runcommand(cmd, replacements, env)
         if self._aborted:
             raise KeyboardInterrupt()
 
@@ -828,9 +827,7 @@
         cmd = '%s "%s"' % (self._shell, fname)
         vlog("# Running", cmd)
 
-        exitcode, output = self._runcommand(cmd, self._testtmp, replacements,
-                                            env, debug=self._debug,
-                                            timeout=self._timeout)
+        exitcode, output = self._runcommand(cmd, replacements, env)
 
         if self._aborted:
             raise KeyboardInterrupt()