def mandatory(test_item):
"""A decorator to mark whole test cases or individual methods as
mandatory. If a mandatory test fails, DataTestRunner will stop
immediately (this is similar to the ``--failfast`` command line
argument behavior)::
@datatest.mandatory
class TestFileFormat(datatest.DataTestCase):
def test_columns(self):
...
"""
test_item.__datatest_mandatory__ = True
return test_item
# The standard unittest.skip decorators are reimplemented to add a
# _wrapped attribute that points to the orignal object so that the
# _sort_key() function can find the proper line number when test_item
# gets wrapped by functools.wraps().
评论列表
文章目录