From 8e91a34b8241198b188e93adeb679e9e1a2cde9a Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 8 Apr 2014 16:27:06 +0000 Subject: [PATCH] [Test] Fix reported number of passed tests The file used to identify the results of the individual Python 3 tests was being truncated. Updating it incrementally seems to avoid the problem. --- test/python/runCythonTests.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/python/runCythonTests.py b/test/python/runCythonTests.py index 52c1bb211..25a68346b 100644 --- a/test/python/runCythonTests.py +++ b/test/python/runCythonTests.py @@ -41,7 +41,9 @@ import cantera.test class TestResult(unittest.TextTestResult): def __init__(self, *args, **kwargs): unittest.TextTestResult.__init__(self, *args, **kwargs) - self.outfile = open('python%d-results.txt' % sys.version_info[0], 'w') + self.outName = 'python%d-results.txt' % sys.version_info[0] + with open(self.outName, 'w') as f: + pass # just create an empty output file def reformat(self, test_string): name, cls = test_string.split() @@ -49,15 +51,18 @@ class TestResult(unittest.TextTestResult): return '%s.%s' % (cls, name) def addSuccess(self, test): - self.outfile.write('PASS: %s\n' % self.reformat(str(test))) + with open(self.outName, 'a') as f: + f.write('PASS: %s\n' % self.reformat(str(test))) unittest.TextTestResult.addSuccess(self, test) def addFailure(self, test, err): - self.outfile.write('FAIL: %s\n' % self.reformat(str(test))) + with open(self.outName, 'a') as f: + f.write('FAIL: %s\n' % self.reformat(str(test))) unittest.TextTestResult.addFailure(self, test, err) def addError(self, test, err): - self.outfile.write('ERROR: %s\n' % self.reformat(str(test))) + with open(self.outName, 'a') as f: + f.write('ERROR: %s\n' % self.reformat(str(test))) unittest.TextTestResult.addFailure(self, test, err)