jenkins-bot submitted this change.

View Change

Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
[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(-)

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 change 1035889. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I4ae5e7ed216aee0023f6270fa918dcbbd93db722
Gerrit-Change-Number: 1035889
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged