Page MenuHomePhabricator

script_tests.py always uses failure exceptions from TestScriptSimulate
Open, HighPublic

Description

script_tests.py has the two test classes TestScriptHelp and TestScriptSimulate derived from TestScriptMeta. Each of it has their own _expected_failures and _allowed_failures attributes but when running the tests, both test classes uses the attribute of TestScriptSimulate.

To demonstrate it I added the class name to _allowed_failures list and always get TestScriptSimulate and modified the metaclass' __new__ method as follows (the first statements):

arguments = dct['_arguments']

print('_expected_failures:', dct['_expected_failures'])
print('_allowed_failures:', dct['_allowed_failures'])

for script_name in script_list:

The result was:

C:\pwb\GIT\core>py -3 pwb.py script_tests -v TestScriptHelp
tests: max_retries reduced from 15 to 1
flickrripper depends on flickrapi, which isn't available
imageharvest depends on bs4, which isn't available
isbn depends on python-stdnum, which isn't available
match_images depends on PIL.ImageTk, which isn't available
states_redirect depends on pycountry, which isn't available
patrol depends on mwparserfromhell>=0.3.3, which isn't available
weblinkchecker depends on memento_client>=0.5.1,!=0.6.0, which isn't available
_expected_failures: set()
_allowed_failures: ['TestScriptHelp']
_expected_failures: {'match_images', 'states_redirect', 'upload', 'catall', 'weblinkchecker', 'imageharvest', 'isbn', 'flickrripper', 'patrol'}
_allowed_failures: ['TestScriptSimulate', 'disambredir', 'imageharvest', 'misspelling', 'watchlist', 'lonelypages']
...
KeyboardInterrupt
CRITICAL: Exiting due to uncaught exception <class 'KeyboardInterrupt'>

C:\pwb\GIT\core>py -3 pwb.py script_tests -v TestScriptSimulate
tests: max_retries reduced from 15 to 1
flickrripper depends on flickrapi, which isn't available
imageharvest depends on bs4, which isn't available
isbn depends on python-stdnum, which isn't available
match_images depends on PIL.ImageTk, which isn't available
states_redirect depends on pycountry, which isn't available
patrol depends on mwparserfromhell>=0.3.3, which isn't available
weblinkchecker depends on memento_client>=0.5.1,!=0.6.0, which isn't available
_expected_failures: set()
_allowed_failures: ['TestScriptHelp']
_expected_failures: {'flickrripper', 'isbn', 'states_redirect', 'weblinkchecker', 'upload', 'match_images', 'catall', 'imageharvest', 'patrol'}
_allowed_failures: ['TestScriptSimulate', 'disambredir', 'imageharvest', 'misspelling', 'watchlist', 'lonelypages']
...
KeyboardInterrupt
CRITICAL: Exiting due to uncaught exception <class 'KeyboardInterrupt'>

C:\pwb\GIT\core>