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
pywikibot-commits@lists.wikimedia.org