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

Change subject: [bugfix] Fix is_symlink method call
......................................................................

[bugfix] Fix is_symlink method call

Change-Id: Ib4aa59aa9b5fd8431b43c356649585d13a9311ca
---
M pywikibot/login.py
1 file changed, 8 insertions(+), 7 deletions(-)

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




diff --git a/pywikibot/login.py b/pywikibot/login.py
index f24b4fc..e4fcf84 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -230,16 +230,17 @@

         params = {} if PYTHON_VERSION < (3, 13) else {'follow_symlinks': False}
         # test for symlink required for Python < 3.13
-        if not password_path.is_file(**params) or password_path.is_symlink:
+        if not password_path.is_file(**params) or password_path.is_symlink():
             password_path = Path(config.password_file)

         # ignore this check when running tests
-        if os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '0':
-            if 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}'
-                )
+        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}'
+            )

         # We fix password file permission first.
         file_mode_checker(password_path, mode=config.private_files_permission)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1152431?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: Ib4aa59aa9b5fd8431b43c356649585d13a9311ca
Gerrit-Change-Number: 1152431
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