jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/508893 )
Change subject: [bugfix] clear tokens on logout() ......................................................................
[bugfix] clear tokens on logout()
- Re-instantiate empty TokenWallet and _paraminfo api cache object when logout - Skip TestLoginLogout tests on AppVeyor that fails with NoUsername error
Bug: T222508 Change-Id: Iec6532bdd745b9c9830e0a048ec79912a4ded23c --- M pywikibot/site.py M tests/site_tests.py 2 files changed, 6 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index 1d94e7e..a37dadb 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -2136,7 +2136,11 @@ token=self.tokens['csrf']) uirequest.submit() self._loginstatus = LoginStatus.NOT_LOGGED_IN + + # Reset tokens and user properties del self._userinfo + self.tokens = TokenWallet(self) + self._paraminfo = api.ParamInfo(self)
def getuserinfo(self, force=False): """Retrieve userinfo from site and store in _userinfo attribute. diff --git a/tests/site_tests.py b/tests/site_tests.py index 0e012c4..2db780d 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -3707,6 +3707,8 @@
"""Test for login and logout methods."""
+ @unittest.skipIf(os.environ.get('APPVEYOR', 'false') == 'true', + 'No user defined for APPVEYOR tests') def test_login_logout(self): """Validate login and logout methods by toggling the state.""" site = self.get_site()
pywikibot-commits@lists.wikimedia.org