Xqt submitted this change.

View Change

Approvals: Xqt: Verified; Looks good to me, approved
[tests] remove PYWIKIBOT_TEST_AUTORUN environment variable

- remove PYWIKIBOT_TEST_AUTORUN environment variable because nosetest
is used for doctest only and no longer affects script_tests.py
- update documentation
- remove code duplication in script_tests.collector
- don't run TestScriptGenerator for scripts in auto_run_script_list
because their behaviour is equal to TestScriptSimulate

Change-Id: I0536ec8a11d2e566255d93c66772b90913ca6498
---
M .appveyor.yml
M .github/workflows/pywikibot-ci.yml
M tests/README.rst
M tests/script_tests.py
4 files changed, 8 insertions(+), 66 deletions(-)

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

PYSETUP_TEST_EXTRAS: "1"
- PYWIKIBOT_TEST_AUTORUN: "1"
PYWIKIBOT_TEST_GUI: "1"
PYWIKIBOT_TEST_RUNNING: "1"

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

env:
- PYWIKIBOT_TEST_AUTORUN: 1
PYWIKIBOT_TEST_RUNNING: 1
PYWIKIBOT_USERNAME: Pywikibot-test

diff --git a/tests/README.rst b/tests/README.rst
index d7c2bba..e2d17e8 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -105,11 +105,6 @@
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_GUI**
Enable :mod:`tests.gui_tests`. Used for Appveyor tests. Github actions would
fail due to ``couldn't connect to display ":1.0"`` error. Set this environment
diff --git a/tests/script_tests.py b/tests/script_tests.py
index d6c0317..a086191 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -139,10 +139,6 @@
}


-enable_autorun_tests = (
- os.environ.get('PYWIKIBOT_TEST_AUTORUN', '0') == '1')
-
-
def collector(loader=unittest.loader.defaultTestLoader):
"""Load the default tests."""
# Note: Raising SkipTest during load_tests will
@@ -153,43 +149,18 @@
unittest_print('Skipping execution of unrunnable scripts:\n {!r}'
.format(unrunnable_script_set))

- if not enable_autorun_tests:
- unittest_print('Skipping execution of auto-run scripts '
- '(set PYWIKIBOT_TEST_AUTORUN=1 to enable):\n {!r}'
- .format(auto_run_script_list))
-
- tests = (['test__login']
- + ['test_' + name
- for name in sorted(script_list)
- if name != 'login'
- and name not in unrunnable_script_set
- ])
-
- test_list = ['tests.script_tests.TestScriptHelp.' + name
+ tests = ['_login'] + [name for name in sorted(script_list)
+ if name != 'login'
+ and name not in unrunnable_script_set]
+ test_list = ['tests.script_tests.TestScriptHelp.test_' + name
for name in tests]

- tests = (['test__login']
- + ['test_' + name
- for name in sorted(script_list)
- if name != 'login'
- and name not in failed_dep_script_set
- and name not in unrunnable_script_set
- and (enable_autorun_tests or name not in auto_run_script_list)
- ])
-
- test_list += ['tests.script_tests.TestScriptSimulate.' + name
+ tests = [name for name in tests if name not in failed_dep_script_set]
+ test_list += ['tests.script_tests.TestScriptSimulate.test_' + name
for name in tests]

- tests = (['test__login']
- + ['test_' + name
- for name in sorted(script_list)
- if name != 'login'
- and name not in failed_dep_script_set
- and name not in unrunnable_script_set
- and (enable_autorun_tests or name not in auto_run_script_list)
- ])
-
- test_list += ['tests.script_tests.TestScriptGenerator.' + name
+ tests = [name for name in tests if name not in auto_run_script_list]
+ test_list += ['tests.script_tests.TestScriptGenerator.test_' + name
for name in tests]

tests = loader.loadTestsFromNames(test_list)
@@ -228,12 +199,6 @@
is_autorun = ('-help' not in args
and script_name in auto_run_script_list)

- def test_skip_script(self):
- raise unittest.SkipTest(
- 'Skipping execution of auto-run scripts (set '
- 'PYWIKIBOT_TEST_AUTORUN=1 to enable) "{}"'
- .format(script_name))
-
def test_script(self):
global_args_msg = \
'For global options use -help:global or run pwb'
@@ -322,8 +287,6 @@
self.assertIn(result['exit_code'], exit_codes)
sys.stdout.flush()

- if not enable_autorun_tests and is_autorun:
- return test_skip_script
return test_script

arguments = dct['_arguments']
@@ -433,46 +396,32 @@
_expected_failures = {
'login',
'add_text',
- 'archivebot',
'category',
- 'category_redirect',
'change_pagelang',
- 'checkimages',
'claimit',
- 'clean_sandbox',
'dataextend',
'data_ingestion',
'delete',
- 'delinker',
'djvutext',
'download_dump',
'harvest_template',
'interwiki',
'listpages',
- 'misspelling',
'movepages',
'pagefromfile',
- 'parser_function_count',
- 'patrol',
'protect',
'redirect',
'reflinks',
'replicate_wiki',
'revertbot',
- 'shell',
'speedy_delete',
'template',
'templatecount',
'transferbot',
- 'unusedfiles',
- 'upload',
- 'watchlist',
- 'welcome',
}

_allowed_failures = [
'basic',
- 'blockpageschecker',
'commonscat',
'commons_information',
'coordinate_import',

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

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