jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/657967 )

Change subject: [tests] Give a more informative AssertionError
......................................................................

[tests] Give a more informative AssertionError

Give a more informative AssertionError if assert does not match

Bug: T272773
Change-Id: Ifea1198aa9817cf01a27c54b37eaceec8eb8ba88
---
M pywikibot/site/__init__.py
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index 662c422..941fbd5 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -336,7 +336,11 @@
         if login_manager.login(retry=True, autocreate=autocreate):
             self._username = login_manager.username
             del self.userinfo  # force reloading
-            assert self.userinfo['name'] == self.username()  # load userinfo
+
+            # load userinfo
+            assert self.userinfo['name'] == self.username(), \
+                '{} != {}'.format(self.userinfo['name'], self.username())
+
             self._loginstatus = _LoginStatus.AS_USER
         else:
             self._loginstatus = _LoginStatus.NOT_LOGGED_IN  # failure

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/657967
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ifea1198aa9817cf01a27c54b37eaceec8eb8ba88
Gerrit-Change-Number: 657967
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to