diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2010-02-25 12:25:41 -0400 |
---|---|---|
committer | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2010-03-02 10:13:11 -0400 |
commit | a13b5b014569c46d9a8b5a09ac24162fada7b9f5 (patch) | |
tree | d5ad4ac66b0b1dfe921778907099aa51c3f46c4b /tests/util | |
parent | b10d28d07f215ae8f237f038db2a5d90009055c5 (diff) |
Replace "requires" class decorator with a simple if (for Python 2.5 compatibility)
Reviewed-by: Lauro Moura <lauro.neto@openbossa.org>
Reviewed-by: Bruno Araujo <bruno.araujo@openbossa.org>
Diffstat (limited to 'tests/util')
-rw-r--r-- | tests/util/helper/decorators.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/tests/util/helper/decorators.py b/tests/util/helper/decorators.py deleted file mode 100644 index ca7f9cdaf..000000000 --- a/tests/util/helper/decorators.py +++ /dev/null @@ -1,43 +0,0 @@ - -'''Decorators for skipping test methods and test cases''' - -import logging -import unittest - - -class requires(object): - '''Skip if the given module is not found - - Usage: - - @requires('RequiredModule') - class MyTestCase(unittest.TestCase): - ... - ''' - - def __init__(self, *args): - '''Setup this decorator. Args should be a list of - module names''' - self.skip = False - - for module in args: - try: - __import__(module) - except ImportError: - self.skip = True - self.skipped = module - break - - def __call__(self, klass): - '''Replace a skipped class with a dummy testCase''' - if not self.skip: - return klass - - logging.warning('Module %s not found. Skipping %s' % (self.skipped, - klass.__name__)) - - class SkipWrapper(unittest.TestCase): - '''Dummy wrapper''' - pass - - return SkipWrapper |