* support specification of output file in print method
* fix: print test to write to an external file
This commit is contained in:
+2
-2
@@ -298,8 +298,8 @@ class autoxml(oo.autosuper):
|
|||||||
for formatter in self.__class__.formatters:
|
for formatter in self.__class__.formatters:
|
||||||
formatter(self, f, errs)
|
formatter(self, f, errs)
|
||||||
cls.format = format
|
cls.format = format
|
||||||
def print_text(self):
|
def print_text(self, file = sys.stdout):
|
||||||
w = Writer() # plain text
|
w = Writer(file) # plain text
|
||||||
f = formatter.AbstractFormatter(w)
|
f = formatter.AbstractFormatter(w)
|
||||||
errs = []
|
errs = []
|
||||||
self.format(f, errs)
|
self.format(f, errs)
|
||||||
|
|||||||
@@ -67,8 +67,9 @@ class AutoXmlTestCase(testcase.TestCase):
|
|||||||
|
|
||||||
self.assert_(not a.check())
|
self.assert_(not a.check())
|
||||||
|
|
||||||
a.print_text()
|
a.print_text(file('/tmp/a', 'w'))
|
||||||
#self.assert_(string.startswith('Name'))
|
la = file('/tmp/a').readlines()
|
||||||
|
self.assert_( util.any(lambda x:x.find('18071976')!=-1, la) )
|
||||||
a.write('/tmp/a.xml')
|
a.write('/tmp/a.xml')
|
||||||
|
|
||||||
def testWriteRead(self):
|
def testWriteRead(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user