jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1326340?usp=email )
Change subject: tests: Avoid login requests in cache test
......................................................................
tests: Avoid login requests in cache test
Rebuilding a cached request creates an APISite and performs a
cookie-only login. The cache test is offline and only validates
reconstructed cache data, so bypass this unrelated network side effect.
Keep the existing sample limit to preserve a bounded runtime.
Bug: T434934
Change-Id: I2c88a9fc2819126cb623fdb81eb855a1af6c0c87
---
M tests/cache_tests.py
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/cache_tests.py b/tests/cache_tests.py
index 7b0d959..e34dd63 100755
--- a/tests/cache_tests.py
+++ b/tests/cache_tests.py
@@ -9,6 +9,7 @@
import re
import unittest
+from unittest.mock import patch
from pywikibot.login import LoginStatus
from pywikibot.site import BaseSite
@@ -39,8 +40,9 @@
def test_cache(self) -> None:
"""Test the apicache by doing _check_cache_entry over each entry."""
- cache.process_entries(join_cache_path(), self._check_cache_entry,
- tests=25)
+ with patch.object(cache.APISite, 'login', return_value=None):
+ cache.process_entries(join_cache_path(), self._check_cache_entry,
+ tests=25)
if __name__ == '__main__':
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1326340?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: I2c88a9fc2819126cb623fdb81eb855a1af6c0c87
Gerrit-Change-Number: 1326340
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[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]