jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/668088 )
Change subject: [tests] Improvements for DeprecationTestCase ......................................................................
[tests] Improvements for DeprecationTestCase
- remove '.pyo' extension which was used by Python < 3.5 with -o option - avoid deeply nested flow control in _build_message
Change-Id: Ifa2abed165d044f332d8c32ae05386baeb5cb4bd --- M tests/aspects.py 1 file changed, 9 insertions(+), 10 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py index f167e64..b170903 100644 --- a/tests/aspects.py +++ b/tests/aspects.py @@ -1408,7 +1408,7 @@ self.warning_log = []
self.expect_warning_filename = inspect.getfile(self.__class__) - if self.expect_warning_filename.endswith(('.pyc', '.pyo')): + if self.expect_warning_filename.endswith('.pyc'): self.expect_warning_filename = self.expect_warning_filename[:-1]
self._do_test_warning_filename = True @@ -1430,18 +1430,17 @@
@classmethod def _build_message(cls, deprecated, instead): - if deprecated is None: - if instead is None: - msg = None - elif instead is True: - msg = cls.INSTEAD - else: - assert instead is False - msg = cls.NO_INSTEAD - else: + if deprecated is not None: msg = '{0} is deprecated'.format(deprecated) if instead: msg += '; use {0} instead.'.format(instead) + elif instead is None: + msg = None + elif instead is True: + msg = cls.INSTEAD + else: + assert instead is False + msg = cls.NO_INSTEAD return msg
def assertDeprecationParts(self, deprecated=None, instead=None):
pywikibot-commits@lists.wikimedia.org