run-tests: move err file writing to tearDown()
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 21 Apr 2014 09:30:11 -0700
changeset 21455 0f0bace82149
parent 21454 046587aa1c8a
child 21456 a06a4142ad1f
run-tests: move err file writing to tearDown()
tests/run-tests.py
--- a/tests/run-tests.py	Sun Apr 20 15:40:22 2014 -0700
+++ b/tests/run-tests.py	Mon Apr 21 09:30:11 2014 -0700
@@ -515,13 +515,6 @@
         else:
             self._result = self.success()
 
-        if (ret != 0 or out != self._refout) and not self._skipped \
-            and not options.debug:
-            f = open(self._errpath, 'wb')
-            for line in out:
-                f.write(line)
-            f.close()
-
         if not self._unittest:
             self.tearDown()
 
@@ -532,6 +525,13 @@
         if not self._options.keep_tmpdir:
             shutil.rmtree(self._testtmp)
 
+        if (self._ret != 0 or self._out != self._refout) and not self._skipped \
+            and not self._options.debug and self._out:
+            f = open(self._errpath, 'wb')
+            for line in self._out:
+                f.write(line)
+            f.close()
+
         vlog("# Ret was:", self._ret)
 
         # Don't print progress in unittest mode because that is handled