Merge branch 'mkenums' into 'master'

tests: Minor improvements to mkenums.py and taptestrunner.py used by it

See merge request GNOME/glib!530
This commit is contained in:
Philip Withnall 2018-12-13 09:13:08 +00:00
commit 27369def50
2 changed files with 7 additions and 7 deletions

View File

@ -285,7 +285,7 @@ comment: {standard_bottom_comment}
"""Test running with no arguments at all."""
result = self.runMkenums()
self.assertEqual('', result.err)
self.assertEquals('''/* {standard_top_comment} */
self.assertEqual('''/* {standard_top_comment} */
/* {standard_bottom_comment} */'''.format(**result.subs),
@ -295,7 +295,7 @@ comment: {standard_bottom_comment}
"""Test running with an empty template and no header files."""
result = self.runMkenumsWithTemplate('')
self.assertEqual('', result.err)
self.assertEquals('''/* {standard_top_comment} */
self.assertEqual('''/* {standard_top_comment} */
/* {standard_bottom_comment} */'''.format(**result.subs),
@ -305,7 +305,7 @@ comment: {standard_bottom_comment}
"""Test running with a complete template, but no header files."""
result = self.runMkenumsWithAllSubstitutions()
self.assertEqual('', result.err)
self.assertEquals('''
self.assertEqual('''
comment
comment: {standard_top_comment}

View File

@ -28,10 +28,7 @@
import unittest
import sys
import base64
if sys.hexversion >= 0x03000000:
from io import StringIO
else:
from StringIO import StringIO
from io import StringIO
# Log modes
class LogMode(object) :
@ -124,6 +121,9 @@ class TAPTestResult(unittest.TestResult):
self.print_raw(" ...\n")
else:
self.print_raw("# " + output.rstrip().replace("\n", "\n# ") + "\n")
# Truncate doesn't change the current stream position.
# Seek to the beginning to avoid extensions on subsequent writes.
log.seek(0)
log.truncate(0)
def addSuccess(self, test):