From: Bob Halley Date: Fri, 19 Jun 2009 09:11:57 +0000 (+0100) Subject: Add option to keep test output X-Git-Tag: v1.7.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e0352386e44aaa03667ef8ce8478164c010b8a7;p=thirdparty%2Fdnspython.git Add option to keep test output --- diff --git a/tests/zone.py b/tests/zone.py index 01136d19..ad7a625a 100644 --- a/tests/zone.py +++ b/tests/zone.py @@ -95,6 +95,8 @@ ns1 1d1s a 10.0.0.1 ns2 1w1D1h1m1S a 10.0.0.2 """ +_keep_output = False + class ZoneTestCase(unittest.TestCase): def testFromFile1(self): @@ -104,7 +106,8 @@ class ZoneTestCase(unittest.TestCase): z.to_file('example1.out', nl='\x0a') ok = filecmp.cmp('example1.out', 'example1.good') finally: - os.unlink('example1.out') + if not _keep_output: + os.unlink('example1.out') self.failUnless(ok) def testFromFile2(self): @@ -114,7 +117,8 @@ class ZoneTestCase(unittest.TestCase): z.to_file('example2.out', relativize=False, nl='\x0a') ok = filecmp.cmp('example2.out', 'example2.good') finally: - os.unlink('example2.out') + if not _keep_output: + os.unlink('example2.out') self.failUnless(ok) def testFromText(self):