jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[tests] flatten require_modules tests decorator

Change-Id: I4c9f658a31cc4479c0532259612ef155c2b7b965
---
M tests/aspects.py
1 file changed, 12 insertions(+), 13 deletions(-)

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


To view, visit change 582491. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4c9f658a31cc4479c0532259612ef155c2b7b965
Gerrit-Change-Number: 582491
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)