tests/heredoctest.py
branchstable
changeset 1108 168da136346a
parent 1107 943253aadddb
child 1109 8458561f6f94
--- a/tests/heredoctest.py	Wed Oct 12 22:01:13 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)