当我输入的时候
$ nosetests -v mytest.py
当所有测试通过时,我的所有打印输出都会被捕获。我希望看到打印输出,即使一切都通过了。
所以我要做的就是强制一个断言错误来查看输出,就像这样。
class MyTest(TestCase):
def setUp(self):
self.debug = False
def test_0(self):
a = .... # construct an instance of something
# ... some tests statements
print a.dump()
if self.debug:
eq_(0,1)
这感觉太黑客了,一定有更好的方法。请开导我一下。
发布于 2011-05-12 16:49:50
以下任一项:
$ nosetests --nocapture mytest.py
或者:
$ NOSE_NOCAPTURE=1 nosetests mytests.py
(也可以在nosetests --help
的nose.cfg
文件中指定)
发布于 2013-09-24 17:30:37
使用
--nologcapture
这对我很管用
发布于 2015-02-11 23:51:26
这是最近添加到nose而不是--nocapture
中的,执行以下操作:
nosetests -s
https://stackoverflow.com/questions/5975194
复制相似问题