我编写了一个nosetest类来测试一个特定的方法-test\u method()
当我运行这个模块的时候,我注意到nosetests运行了其他的方法,就像我们一样-create\u test\u private\u方法。你知道吗
我以为鼻测试只会测试从测试开始的方法。你知道吗
import unittest
class test(unittest.TestCase):
def create_test_private_method(self):
self.assertEqual(1,1)
def test_method(self):
self.assertEqual(2,2)
输出:
create_test_private_method (nosetest.test) ... ok
test_method (nosetest.test) ... ok
----------------------------------------------------------------------
Ran 2 tests in 0.009s
OK
从nosetests docs:
为了避免这种行为,你可以
相关问题 更多 >
编程相关推荐