jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035889?usp=email )
Change subject: [tests] rename environment variable PYWIKIBOT_LOGIN_LOGOUT
......................................................................
[tests] rename environment variable PYWIKIBOT_LOGIN_LOGOUT
rename environment variable PYWIKIBOT_LOGIN_LOGOUT to
PYWIKIBOT_TEST_LOGOUT to be consistent with other test environment
variables. Also add documentation to tests/README.rst.
Change-Id: I4ae5e7ed216aee0023f6270fa918dcbbd93db722
---
M .github/workflows/login_tests-ci.yml
M tests/README.rst
M tests/site_login_logout_tests.py
3 files changed, 14 insertions(+), 4 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/.github/workflows/login_tests-ci.yml b/.github/workflows/login_tests-ci.yml
index bc718bc..dc1de99 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -10,8 +10,8 @@
env:
PYWIKIBOT_TEST_RUNNING: 1
+ PYWIKIBOT_TEST_LOGOUT: 1
PYWIKIBOT_USERNAME: Pywikibot-test
- PYWIKIBOT_LOGIN_LOGOUT: 1
jobs:
build:
diff --git a/tests/README.rst b/tests/README.rst
index e6880d0..a6f1265 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -105,6 +105,16 @@
PYWIKIBOT_TEST_GUI=1
+**PYWIKIBOT_TEST_LOGOUT**
+ Used when a test is logging out the test user. This environment variable
+ enables :mod:`tests.site_login_logout_tests`. The environment setting is
+ needed to ensure that these tests run in their own test action and does not
+ interfere with other tests. Otherwise they could fail if the test user is
+ logged out by the test. Only one instance must run this test script. Set this
+ environment variable to run this test locally::
+
+ PYWIKIBOT_TEST_LOGOUT=1
+
**PYWIKIBOT_TEST_MODULES**
Only run tests given with this environment variable. Multiple tests must be
separated by a ``,`` without any white space. Available library tests are
diff --git a/tests/site_login_logout_tests.py b/tests/site_login_logout_tests.py
index 18e0072..c4805c8 100755
--- a/tests/site_login_logout_tests.py
+++ b/tests/site_login_logout_tests.py
@@ -6,7 +6,7 @@
to fail.
"""
#
-# (C) Pywikibot team, 2022-2023
+# (C) Pywikibot team, 2022-2024
#
# Distributed under the terms of the MIT license.
#
@@ -82,8 +82,8 @@
def setUpModule():
- """Skip tests if PYWIKIBOT_LOGIN_LOGOUT variable is not set."""
- if os.environ.get('PYWIKIBOT_LOGIN_LOGOUT', '0') != '1':
+ """Skip tests if PYWIKIBOT_TEST_LOGOUT variable is not set."""
+ if os.environ.get('PYWIKIBOT_TEST_LOGOUT', '0') != '1':
raise unittest.SkipTest('login/logout tests are disabled')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035889?usp=email
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: I4ae5e7ed216aee0023f6270fa918dcbbd93db722
Gerrit-Change-Number: 1035889
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035864?usp=email )
Change subject: Revert "[IMPR] use CachedRequest for userinfo requests"
......................................................................
Revert "[IMPR] use CachedRequest for userinfo requests"
This reverts commit 07adfba14c901e46a4c794c3b4f5ad673a7f7885.
Bug: T348925
Bug: T365942
Change-Id: Ie8e34ff2678d5f548b05b796895dc3264689f45b
---
M ROADMAP.rst
M pywikibot/config.py
M pywikibot/site/_apisite.py
3 files changed, 5 insertions(+), 15 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index e42e037..30a077d 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,6 @@
Current release
---------------
-* Use :class:`data.api.CachedRequest` for userinfo requests (:phab:`T348925`)
* Raise :exc:`exceptions.SectionError` if a section does not exists on a page (:phab:`T107141`)
* Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)
diff --git a/pywikibot/config.py b/pywikibot/config.py
index b2f20fb..7f12bcc 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -175,8 +175,6 @@
site_interface = 'APISite'
# number of days to cache namespaces, api configuration, etc.
API_config_expiry = 30
-# userinfo expiry
-API_uinfo_expiry = 1
# The maximum number of bytes which uses a GET request, if not positive
# it'll always use POST requests
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 0fe76de..729a7ec 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -648,10 +648,6 @@
.. seealso:: :api:`Userinfo`
.. versionchanged:: 8.0
Use API formatversion 2.
- .. versionchanged:: 9.2
- API call is made through :class:`data.api.CachedRequest` with
- expiry is set in ``API_uinfo_expiry`` within
- :ref:`Account settings`.
:return: A dict with the following keys and values:
@@ -665,14 +661,11 @@
"""
if not hasattr(self, '_userinfo'):
- uirequest = self._request(
- expiry=pywikibot.config.API_uinfo_expiry,
- parameters={
- 'action': 'query',
- 'meta': 'userinfo',
- 'uiprop': 'blockinfo|hasmsg|groups|rights|ratelimits',
- 'formatversion': 2,
- }
+ uirequest = self.simple_request(
+ action='query',
+ meta='userinfo',
+ uiprop='blockinfo|hasmsg|groups|rights|ratelimits',
+ formatversion=2,
)
uidata = uirequest.submit()
assert 'query' in uidata, \
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035864?usp=email
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: Ie8e34ff2678d5f548b05b796895dc3264689f45b
Gerrit-Change-Number: 1035864
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged