这可能真的很蠢,但我不能让它起作用.我想在nose2中使用nose2 DLS,在Linux中使用python2.7。我正在从文档dsl.html (请参阅下面的代码)中尝试这个示例的开头,但是它不运行测试,不管我如何从命令行启动它。
我的文件名为test_something.py,它是目录中唯一的文件。我尝试过使用>> nose2和>> nose2 --plugin nose2.plugins.layers从命令行运行,但总是得到Ran 0 tests in 0.000s。有了>> nose2 --plugin layers,我得到了ImportError: No module named layers。
我应该如何从命令行运行这个测试??谢谢!
代码如下:
import unittest
from nose2.tools import such
with such.A("system with complex setup") as it:
@it.has_setup
def setup():
print "Setup"
it.things = [1]
@it.has_teardown
def teardown():
print "Teardown"
it.things = []
@it.should("do something")
def test():
print "Test"
assert it.things
it.assertEqual(len(it.things), 1)发布于 2016-01-14 15:30:58
哈!我忘了在文件末尾添加it.createTests(globals())!
https://stackoverflow.com/questions/34793047
复制相似问题