# HG changeset patch # User Augie Fackler # Date 2015-03-13 17:03:55 # Node ID 9612b96730d7309315d15d4ad3d9b20aa1bc29b1 # Parent d3bdd8c7174f02e8e700c792d635ef39c5ad2d7d run-tests: ignore ENOENT failures when removing old .err results When the same test runs in multiple threads and the previous run was a failure, the threads can race to delete the error output. This fixes that. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -461,7 +461,14 @@ class Test(unittest.TestCase): # Remove any previous output files. if os.path.exists(self.errpath): - os.remove(self.errpath) + try: + os.remove(self.errpath) + except OSError, e: + # We might have raced another test to clean up a .err + # file, so ignore ENOENT when removing a previous .err + # file. + if e.errno != errno.ENOENT: + raise def run(self, result): """Run this test and report results against a TestResult instance."""