jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831060 )
Change subject: [doc] Add description for PYWIKIBOT_TEST_AUTORUN and PYWIKIBOT_TEST_MODULES
......................................................................
[doc] Add description for PYWIKIBOT_TEST_AUTORUN and PYWIKIBOT_TEST_MODULES
Change-Id: Iae2b53210eebc3183f578603649cfe20232f7a9b
---
M tests/README.rst
M tests/script_tests.py
2 files changed, 20 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/README.rst b/tests/README.rst
index f53fdd6..cbaee97 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -105,11 +105,29 @@
Environment variables
=====================
+**PYWIKIBOT_TEST_AUTORUN**
+ Enable script tests running automatically without specifying a generator.
+ The scripts are listed in :attr:`tests.script_tests.auto_run_script_list`.
+ Currently only *deeptest* uses it.
+
+**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
+ listed in :ref:`Library tests` and script tests can be found in
+ :ref:`Script tests`. To enable only :mod:`tests.site_tests` and
+ :mod:`tests.wikibase_tests` set the environment variable as::
+
+ PYWIKIBOT_TEST_MODULES=site,wikibase
+
+ .. note:: test names must be given without subsequent ``_tests``.
+
**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.
+ coverage. Github actions and Appveyor tests activate this variable::
+
+ PYWIKIBOT_TEST_RUNNING=1
**PYWIKIBOT_TEST_WRITE**
There are also several other 'write' tests which also attempt to perform
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 7afeb2f..777815b 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -76,6 +76,7 @@
'8/80/Wikipedia-logo-v2.svg\n\n\n',
}
+#:
auto_run_script_list = [
'archivebot',
'blockpageschecker',
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831060
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: Iae2b53210eebc3183f578603649cfe20232f7a9b
Gerrit-Change-Number: 831060
Gerrit-PatchSet: 1
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/+/831052 )
Change subject: [tests] Rename PYWIKIBOT_TESTS_RUNNING environment variable
......................................................................
[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(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
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 https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831052
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: I8d5b4d454ae9662311993898567dddb2e3d17e8b
Gerrit-Change-Number: 831052
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831043 )
Change subject: [doc] Update test documentation
......................................................................
[doc] Update test documentation
Add definition list to README.rst for test environment variables
Change-Id: I5d402eb4416658b330ef1f1451a0d3b4622dbf22
---
M tests/README.rst
1 file changed, 24 insertions(+), 22 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/tests/README.rst b/tests/README.rst
index 9e5e5ee..85d1ea5 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -105,36 +105,38 @@
Environment variables
=====================
-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_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.
-These 'edit failure' tests are disabled by default. On Travis they are enabled
-by default on builds by any other GitHub account except 'wikimedia'.
+ 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
+ To disable 'edit failure' tests, set PYWIKIBOT_TEST_WRITE_FAIL=0
-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.
+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.
-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.
+ 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.
-To enable 'write' tests, set PYWIKIBOT_TEST_WRITE=1
+ To enable 'write' tests, set PYWIKIBOT_TEST_WRITE=1
Enabling only 'edit failure' tests or 'write' tests won't enable the other tests
automatically.
Decorators
-=====================
+==========
pywikibot's test suite, including Python's unittest module, provides decorators
to modify the behaviour of the test cases.
@unittest.skipIf
------------------
+----------------
Skip a test if the condition is true. Refer to unittest's documentation.
::
@@ -145,7 +147,7 @@
def test_skipIf(self):
@unittest.skipUnless
----------------------
+--------------------
Skip a test unless the condition is true. Refer to unittest's documentation.
::
@@ -246,9 +248,9 @@
Other class attributes
----------------------
-- ``net = False`` : test class does not use a site
-- ``dry = True`` : test class can use a fake site object
-- ``cached = True``: test class may aggressively cache API responses
-- ``login = True`` : test class needs to login to site
-- ``rights = '<rights>'`` : test class needs specific rights. Multiple rights must be delimited with `,`.
-- ``write = True`` : test class needs to write to a site
+- ``net = False``: test class does not use a site
+- ``dry = True``: test class can use a fake site object
+- ``cached = True``: test class may aggressively cache API responses
+- ``login = True``: test class needs to login to site
+- ``rights = '<rights>'``: test class needs specific rights. Multiple rights must be delimited with ``,``.
+- ``write = True``: test class needs to write to a site
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831043
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: I5d402eb4416658b330ef1f1451a0d3b4622dbf22
Gerrit-Change-Number: 831043
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/830187 )
Change subject: [IMPR] Improvements for dataextend.py
......................................................................
[IMPR] Improvements for dataextend.py
- add typing hints for html parameter
- add typing hints for findnames method
- always return a list with findnames
- update funcnames list in __getattr__
Change-Id: Ie9e84caac4c036ced97a42c9bf6b2139b34f496a
---
M scripts/dataextend.py
1 file changed, 2,668 insertions(+), 2,583 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/830187
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: Ie9e84caac4c036ced97a42c9bf6b2139b34f496a
Gerrit-Change-Number: 830187
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged