I fixed the nose print bug, where the first run of a test with a print statement would pass but any run thereafter would fail.
Get the fix here:
http://github.com/antlong/nose
If you see this error, then you need to checkout my fix:
ERROR: test.test
———————————————————————-
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/nose/case.py", line 188, in runTest
test(*self.arg)
File "/Users/along/Desktop/nosetest/test.py", line 2, in test
print("hello")
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/StringIO.py", line 213, in write
_complain_ifclosed(self.closed)
TypeError: ‘NoneType’ object is not callable
The fix lies in editing capture.py to remove the two commented items from start()
def formatError(self, test, err):
"""Add captured output to error report.
"""
test.capturedOutput = output = self.buffer
#COMMENT THIS LINE BELOW
#self._buf = None
if not output:
# Don't return None as that will prevent other
# formatters from formatting and remove earlier formatters
# formats, instead return the err we got
return err
ec, ev, tb = err
return (ec, self.addCaptureToErr(ev, output), tb)
Also for good measure, change
from StringIO import StringIO
to
from cStringIO import StringIO


