support unittest setUpModule/tearDownModule

This commit is contained in:
variedthoughts 2013-06-20 14:43:42 +00:00
parent 4af052b098
commit 3bcd3317ad
1 changed files with 6 additions and 2 deletions

View File

@ -371,7 +371,9 @@ class Module(pytest.File, PyCollector):
return mod return mod
def setup(self): def setup(self):
setup_module = xunitsetup(self.obj, "setup_module") setup_module = xunitsetup(self.obj, "setUpModule")
if setup_module is None:
setup_module = xunitsetup(self.obj, "setup_module")
if setup_module is not None: if setup_module is not None:
#XXX: nose compat hack, move to nose plugin #XXX: nose compat hack, move to nose plugin
# if it takes a positional arg, its probably a pytest style one # if it takes a positional arg, its probably a pytest style one
@ -382,7 +384,9 @@ class Module(pytest.File, PyCollector):
setup_module() setup_module()
def teardown(self): def teardown(self):
teardown_module = xunitsetup(self.obj, 'teardown_module') teardown_module = xunitsetup(self.obj, 'tearDownModule')
if teardown_module is None:
teardown_module = xunitsetup(self.obj, 'teardown_module')
if teardown_module is not None: if teardown_module is not None:
#XXX: nose compat hack, move to nose plugin #XXX: nose compat hack, move to nose plugin
# if it takes a positional arg, its probably a py.test style one # if it takes a positional arg, its probably a py.test style one