jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[tests] Rename PYWIKIBOT_TESTS_RUNNING environment variable

- rename PYWIKIBOT_TESTS_RUNNING to PYWIKIBOT_TEST_RUNNING to be consistent
with other PYWIKIBOT_TEST_... environment variables
- add this environment variable to tests/README.rst and documentation

Change-Id: I8d5b4d454ae9662311993898567dddb2e3d17e8b
---
M .appveyor.yml
M .github/workflows/login_tests-ci.yml
M .github/workflows/pywikibot-ci.yml
M pywikibot/data/api/_requests.py
M tests/README.rst
M tests/script_tests.py
6 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/.appveyor.yml b/.appveyor.yml
index 75a438e..f534951 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -9,7 +9,7 @@
PYWIKIBOT_PASSWD_FILE: "%appdata%\\Pywikibot\\passwordfile"

PYSETUP_TEST_EXTRAS: "1"
- PYWIKIBOT_TESTS_RUNNING: "1"
+ PYWIKIBOT_TEST_RUNNING: "1"

matrix:

diff --git a/.github/workflows/login_tests-ci.yml b/.github/workflows/login_tests-ci.yml
index c6a97f2..55d5246 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -12,7 +12,7 @@
- completed

env:
- PYWIKIBOT_TESTS_RUNNING: 1
+ PYWIKIBOT_TEST_RUNNING: 1
PYWIKIBOT_LOGIN_LOGOUT: 1
PYWIKIBOT_USERNAME: Pywikibot-test

diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml
index 21be465..ae29edc 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -11,7 +11,7 @@
branches: [ master ]

env:
- PYWIKIBOT_TESTS_RUNNING: 1
+ PYWIKIBOT_TEST_RUNNING: 1
PYWIKIBOT_USERNAME: Pywikibot-test

jobs:
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index 4d26391..5e1d564 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -1110,7 +1110,7 @@
raise RuntimeError(result)

msg = 'Maximum retries attempted due to maxlag without success.'
- if os.environ.get('PYWIKIBOT_TESTS_RUNNING', '0') == '1':
+ if os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '1':
import unittest
raise unittest.SkipTest(msg)

diff --git a/tests/README.rst b/tests/README.rst
index 85d1ea5..f53fdd6 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -105,29 +105,39 @@
Environment variables
=====================

-PYWIKIBOT_TEST_WRITE_FAIL
- There are a set of 'edit failure' tests, which attempt to write to the wikis
- and **should** fail. If there is a bug in pywikibot or MediaWiki, these
- tests **may** actually perform a write operation.
+**PYWIKIBOT_TEST_RUNNING**
+ This environment variable skips tests instead of raising
+ :exc:`exceptions.MaxlagTimeoutError` when maximum retries attempted due to
+ maxlag without success. It is also used by :mod:`tests.script_tests` for code
+ coverage. Github actions and Appveyor tests activate this variable.

- These 'edit failure' tests are disabled by default. On Travis they are enabled
- by default on builds by any other GitHub account except 'wikimedia'.
+**PYWIKIBOT_TEST_WRITE**
+ There are also several other 'write' tests which also attempt to perform
+ write operations successfully. These **will** write to the wikis, and they
+ should always only write to 'test' wikis.

- To disable 'edit failure' tests, set PYWIKIBOT_TEST_WRITE_FAIL=0
+ These 'write' tests are disabled by default, and currently cannot be
+ run on Travis or AppVeyor as they require interaction using a terminal. Also
+ enabling them won't enable 'edit failure' tests.

-PYWIKIBOT_TEST_WRITE
- There are also several other 'write' tests which also attempt to perform
- write operations successfully. These **will** write to the wikis, and they
- should always only write to 'test' wikis.
+ To enable 'write' tests, set::

- These 'write' tests are disabled by default, and currently cannot be
- run on Travis or AppVeyor as they require interaction using a terminal. Also
- enabling them won't enable 'edit failure' tests.
+ PYWIKIBOT_TEST_WRITE=1

- To enable 'write' tests, set PYWIKIBOT_TEST_WRITE=1
+**PYWIKIBOT_TEST_WRITE_FAIL**
+ There are a set of 'edit failure' tests, which attempt to write to the wikis
+ and **should** fail. If there is a bug in pywikibot or MediaWiki, these
+ tests **may** actually perform a write operation.

-Enabling only 'edit failure' tests or 'write' tests won't enable the other tests
-automatically.
+ These 'edit failure' tests are disabled by default. On Travis they are enabled
+ by default on builds by any other GitHub account except 'wikimedia'.
+
+ To disable 'edit failure' tests, set::
+
+ PYWIKIBOT_TEST_WRITE_FAIL=0
+
+.. note:: Enabling only 'edit failure' tests or 'write' tests won't enable the other tests
+ automatically.

Decorators
==========
diff --git a/tests/script_tests.py b/tests/script_tests.py
index d499269..7afeb2f 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -17,7 +17,7 @@
from tests.utils import execute_pwb


-ci_test_run = os.environ.get('PYWIKIBOT_TESTS_RUNNING', '0') == '1'
+ci_test_run = os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '1'
scripts_path = join_root_path('scripts')

# login scritpt should be the first to test

To view, visit change 831052. To unsubscribe, or for help writing mail filters, visit settings.

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