jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/894530 )
Change subject: [tests] Ensure that login is made prior than rights are checked ......................................................................
[tests] Ensure that login is made prior than rights are checked
Bug: T331266 Change-Id: I19bdf4a7db13996a93cfbd8fbe5ad817931ab97c --- M tests/aspects.py 1 file changed, 16 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py index 5ab221c..b011986 100644 --- a/tests/aspects.py +++ b/tests/aspects.py @@ -601,8 +601,7 @@
@classmethod def setUpClass(cls): - """ - Set up the test class. + """Set up the test class.
Skip the test class if the user config does not have a valid login to the site. @@ -853,12 +852,16 @@ bases = cls.add_base(bases, SiteWriteMixin)
if dct.get('rights'): - bases = cls.add_base(bases, NeedRightsMixin) dct.setdefault('login', True)
if dct.get('login'): bases = cls.add_base(bases, RequireLoginMixin)
+ # Add NeedRightsMixin after RequireLoginMixin to ensure + # login is made prior to rights check + if dct.get('rights'): + bases = cls.add_base(bases, NeedRightsMixin) + for test in tests: test_func = dct[test]