jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/582491 )
Change subject: [tests] flatten require_modules tests decorator ......................................................................
[tests] flatten require_modules tests decorator
Change-Id: I4c9f658a31cc4479c0532259612ef155c2b7b965 --- M tests/aspects.py 1 file changed, 12 insertions(+), 13 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py index 8f301d2..d8a34a1 100644 --- a/tests/aspects.py +++ b/tests/aspects.py @@ -359,20 +359,19 @@ __import__(required_module, globals(), locals(), [], 0) except ImportError: missing += [required_module] - if missing: - skip_decorator = unittest.skip('{0} not installed'.format( - ', '.join(missing))) - if (inspect.isclass(obj) and issubclass(obj, TestCaseBase) - and 'nose' in sys.modules.keys()): - # There is a known bug in nosetests which causes setUpClass() - # to be called even if the unittest class is skipped. - # Here, we decorate setUpClass() as a patch to skip it - # because of the missing modules too. - # Upstream report: https://github.com/nose-devs/nose/issues/946 - obj.setUpClass = classmethod(skip_decorator(lambda cls: None)) - return skip_decorator(obj) - else: + if not missing: return obj + skip_decorator = unittest.skip('{0} not installed'.format( + ', '.join(missing))) + if (inspect.isclass(obj) and issubclass(obj, TestCaseBase) + and 'nose' in sys.modules.keys()): + # There is a known bug in nosetests which causes setUpClass() + # to be called even if the unittest class is skipped. + # Here, we decorate setUpClass() as a patch to skip it + # because of the missing modules too. + # Upstream report: https://github.com/nose-devs/nose/issues/946 + obj.setUpClass = classmethod(skip_decorator(lambda cls: None)) + return skip_decorator(obj)
return test_requirement
pywikibot-commits@lists.wikimedia.org