summaryrefslogtreecommitdiff
path: root/logilab
diff options
context:
space:
mode:
authorDavid Douard <david.douard@logilab.fr>2014-11-27 16:11:32 +0100
committerDavid Douard <david.douard@logilab.fr>2014-11-27 16:11:32 +0100
commit1c9eddb0ad19842d1bc4edd19cf47f4847e06861 (patch)
tree2e9547f6f3670ba0f51a79074eb0ea76e6049f07 /logilab
parent69ca62f2e1bfe1796692906290d775d6bd1b6b44 (diff)
downloadlogilab-common-1c9eddb0ad19842d1bc4edd19cf47f4847e06861.tar.gz
[testlib] remove support for deprecated module level fixture names
setup_module() and teardown_module() support have been deprecated 4 years ago in commit 06755c704e60.
Diffstat (limited to 'logilab')
-rw-r--r--logilab/common/testlib.py57
1 files changed, 0 insertions, 57 deletions
diff --git a/logilab/common/testlib.py b/logilab/common/testlib.py
index ab535a2..a6b4b1e 100644
--- a/logilab/common/testlib.py
+++ b/logilab/common/testlib.py
@@ -330,63 +330,6 @@ class _DebugResult(object): # simplify import statement among unittest flavors..
_moduleSetUpFailed = False
shouldStop = False
-from logilab.common.decorators import monkeypatch
-@monkeypatch(unittest.TestSuite)
-def _handleModuleTearDown(self, result):
- previousModule = self._get_previous_module(result)
- if previousModule is None:
- return
- if result._moduleSetUpFailed:
- return
- try:
- module = sys.modules[previousModule]
- except KeyError:
- return
- # add testlib specific deprecation warning and switch to new api
- if hasattr(module, 'teardown_module'):
- warnings.warn('Please rename teardown_module() to tearDownModule() instead.',
- DeprecationWarning)
- setattr(module, 'tearDownModule', module.teardown_module)
- # end of monkey-patching
- tearDownModule = getattr(module, 'tearDownModule', None)
- if tearDownModule is not None:
- try:
- tearDownModule()
- except Exception as e:
- if isinstance(result, _DebugResult):
- raise
- errorName = 'tearDownModule (%s)' % previousModule
- self._addClassOrModuleLevelException(result, e, errorName)
-
-@monkeypatch(unittest.TestSuite)
-def _handleModuleFixture(self, test, result):
- previousModule = self._get_previous_module(result)
- currentModule = test.__class__.__module__
- if currentModule == previousModule:
- return
- self._handleModuleTearDown(result)
- result._moduleSetUpFailed = False
- try:
- module = sys.modules[currentModule]
- except KeyError:
- return
- # add testlib specific deprecation warning and switch to new api
- if hasattr(module, 'setup_module'):
- warnings.warn('Please rename setup_module() to setUpModule() instead.',
- DeprecationWarning)
- setattr(module, 'setUpModule', module.setup_module)
- # end of monkey-patching
- setUpModule = getattr(module, 'setUpModule', None)
- if setUpModule is not None:
- try:
- setUpModule()
- except Exception as e:
- if isinstance(result, _DebugResult):
- raise
- result._moduleSetUpFailed = True
- errorName = 'setUpModule (%s)' % currentModule
- self._addClassOrModuleLevelException(result, e, errorName)
-
# backward compatibility: TestSuite might be imported from lgc.testlib
TestSuite = unittest.TestSuite