【发布时间】:2014-11-07 16:48:15
【问题描述】:
我在这里有一个简单的 Python 类,它有 3 个函数。 "test_a" (attr=slow)、"test_b" (attr=fast) 和 init()。 init() 中的打印语句不会被调用,无论我是否在其中使用“attr”。我怎样才能调用 init() ?或者甚至可以用鼻子测试来做到这一点?
from testconfig import config as c
from nose.plugins.attrib import attr
class TestMe(object):
@attr(speed='slow')
def __init__(self):
print "I am inside init of test_me"
@attr(speed='slow')
def test_a(self):
assert 'c' == 'c'
print "I am here_a"
@attr(speed='fast')
def test_b(self):
assert 'c' == 'c'
print "I am here_b"
【问题讨论】:
标签: python function init attr nose