jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1200013?usp=email )

Change subject: Revert "Test: Extract error message for T408721"
......................................................................

Revert "Test: Extract error message for T408721"

This reverts commit 1a8d1246800b7565b9bfb2b87a70ca0b1d5a28da.

Reason for revert: No longer needed

Change-Id: I2e3b0ebcaf965254e486f8034629199bfa7e0db4
---
M pywikibot/login.py
1 file changed, 3 insertions(+), 13 deletions(-)

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




diff --git a/pywikibot/login.py b/pywikibot/login.py
index 2d9b9d9..94650e9 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -34,9 +34,6 @@
     mwoauth = e


-TEST_RUNNING = os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '1'
-
-
 class _PasswordFileWarning(UserWarning):

     """The format of password file is incorrect."""
@@ -237,8 +234,9 @@
             password_path = Path(config.password_file)

         # ignore this check when running tests
-        if not TEST_RUNNING and (not password_path.is_file(**params)
-                                 or password_path.is_symlink()):
+        if os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '0' \
+           and (not password_path.is_file(**params)
+                or password_path.is_symlink()):
             raise FileNotFoundError(
                 f'Password file {password_path.name} does not exist in '
                 f'{password_path.parent}'
@@ -624,8 +622,6 @@
                 pywikibot.error(e)
                 if retry:
                     return self.login(retry=True, force=force)
-                if TEST_RUNNING:
-                    print('>>> login:', e)  # noqa: T201
                 return False
         else:
             pywikibot.info(f'Logged in to {self.site} via consumer '
@@ -670,8 +666,6 @@
         """
         if self.access_token is None:
             pywikibot.error('Access token not set')
-            if TEST_RUNNING:
-                print('>>> identity: Access token not set')  # noqa: T201
             return None

         consumer_token = mwoauth.ConsumerToken(*self.consumer_token)
@@ -683,11 +677,7 @@
                                         leeway=30.0)
         except Exception as e:
             pywikibot.error(e)
-            if TEST_RUNNING:
-                print('<<< identity:', e)  # noqa: T201
         else:
-            if TEST_RUNNING:
-                print('<<< identity =', identity)  # noqa: T201
             return identity

         return None

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2e3b0ebcaf965254e486f8034629199bfa7e0db4
Gerrit-Change-Number: 1200013
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to