changeset 15247:3cd1605e9d8e

tests: remove temp doctest file when finished running it
author Idan Kamara <idankk86@gmail.com>
date Thu, 13 Oct 2011 17:54:35 +0200
parents 7b15dd9125b3
children 3efbb5e8bf5c
files tests/heredoctest.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/heredoctest.py	Thu Oct 13 04:27:49 2011 +0200
+++ b/tests/heredoctest.py	Thu Oct 13 17:54:35 2011 +0200
@@ -2,8 +2,12 @@
 
 if __name__ == "__main__":
     fd, name = tempfile.mkstemp(suffix='hg-tst')
-    os.write(fd, sys.stdin.read())
-    os.close(fd)
-    failures, _ = doctest.testfile(name, module_relative=False)
-    if failures:
-        sys.exit(1)
+
+    try:
+        os.write(fd, sys.stdin.read())
+        os.close(fd)
+        failures, _ = doctest.testfile(name, module_relative=False)
+        if failures:
+            sys.exit(1)
+    finally:
+        os.remove(name)