| Index: test.py |
| =================================================================== |
| --- test.py (revision 684) |
| +++ test.py (working copy) |
| @@ -101,7 +101,8 @@ |
| env: optional; dict of environment variables to set. |
| Returns: |
| - The captured stdout + stderr as a string. |
| + (output, retcode) where output is captured stdout + stderr as a string; |
| + retcode is the process's return code. |
| Raises: |
| RuntimeError: if the command failed. The value of the exception will |
| @@ -114,7 +115,7 @@ |
| with BuildBotMollifier(): |
| result, err = subproc.communicate() |
| print result + err, |
| - return result + err |
| + return (result + err, subproc.returncode) |
| def DefaultPassCheck(command, env=None): |
| @@ -130,13 +131,18 @@ |
| Returns: |
| True if the test passed, False otherwise. |
| """ |
| - output = CallAndCaptureOutput(command, env) |
| + output, _ = CallAndCaptureOutput(command, env) |
| lines = output.splitlines() |
| if not lines: |
| return False |
| return lines[-1].startswith("OK") |
| +def CheckReturnCode(command): |
| + output, ret_code = CallAndCaptureOutput(command) |
| + return ret_code == 0 |
| + |
| + |
| ### Wrappers for the third-party modules we don't want to break go here. ### |
| def Test2to3(): |
| @@ -149,6 +155,9 @@ |
| return DefaultPassCheck([sys.executable, "-E", "Test.py"], |
| env={"PATH": path}) |
| +def TestCvs2svn(): |
| + return CheckReturnCode([sys.executable, "-E", "run-tests.py", "-v"]) |
|
Jeffrey Yasskin
2009/07/03 05:25:35
We probably want to print the output on failure.
Collin Winter
2009/07/04 03:59:02
On 2009/07/03 05:25:35, Jeffrey Yasskin wrote:
> W
|
| + |
| def TestDjango(): |
| py_path = os.path.join("..", "..", "correctness") |
| test_runner = os.path.join("tests", "runtests.py") |
| @@ -175,7 +184,7 @@ |
| def TestPyxml(): |
| with ChangeDir("test"): |
| - output = CallAndCaptureOutput([sys.executable, "-E", "regrtest.py"]) |
| + output, _ = CallAndCaptureOutput([sys.executable, "-E", "regrtest.py"]) |
| lines = output.splitlines() |
| return lines[-1].endswith("OK.") |
| @@ -183,11 +192,10 @@ |
| return DefaultPassCheck([sys.executable, "-E", "setup.py", "test"]) |
| def TestSwig(): |
| - ret_code = subprocess.call(["make", "check"]) |
| - return ret_code == 0 |
| + return CheckReturnCode(["make", "check"]) |
| def TestSympy(): |
| - output = CallAndCaptureOutput([sys.executable, "-E", "setup.py", "test"]) |
| + output, _ = CallAndCaptureOutput([sys.executable, "-E", "setup.py", "test"]) |
| return not output.endswith("DO *NOT* COMMIT!\n") |
| def TestZope_interface(): |