저는 PyDev로 코 테스트를 성공적으로 수행하여 nose2를 사용해보고 싶습니다.pydev가 nose2를 지원합니다.
그래서 나는/
pip install nose2
사본을 설치 'test_script_with_nose2'라는 새로운 모듈에 http://nose2.info/에서 샘플 코드를 붙여 :
from nose2.compat import unittest
from nose2.tools import params
def tests_can_be_functions():
assert True
def tests_can_be_generators():
def check(val):
assert val == val, "Identity failure!"
for i in range(1, 4):
yield check, i
@params(1, 2, 3)
def tests_can_take_parameters(p):
assert p < 4, "How'd that get here?"
class TestsCanBeUnittestTestCases(unittest.TestCase):
def setUp(self):
self.x = 1
def test_one(self):
self.assertEqual(self.x, 1)
class TestsCanBePlainClasses(object):
def setUp(self):
self.me_too = 1
def test(self):
assert self.me_too == 1, "Not me too?"
하지만이 오류가
======================================================================
ERROR: test_script_with_nose2.tests_can_take_parameters
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
TypeError: tests_can_take_parameters() takes exactly 1 argument (0 given)
----------------------------------------------------------------------
Ran 7 tests in 0.014s
FAILED (errors=1)
pydev에서 단위 테스트 러너로 선정 된 코가 있지만, 아마도 그렇지 않습니다. nose2에 대한 새로운 주자? 그렇다면 누구나이 작업을 수행 할 수 있습니다. 아니면 내가 여기에 사소한 것을 놓치고 있니?