Xqt created this task.
Xqt added projects: Pywikibot, Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
**Steps to replicate the issue** (include links if applicable):
remove mwversion usage by replacing
if ('tokens' not in meta and 'continue' not in self._params
and self.site.mw_version >= '1.25wmf5'):
in api/_requests.py line 440 with
if 'tokens' not in meta and 'continue' not in self._params:
- `pwb api_tests -v TestLazyLoginNotExistUsername`
- `pwb api_tests -v TestLazyLoginNoUsername`
**What happens?**:
The tests fails:
https://integration.wikimedia.org/ci/job/pywikibot-core-tox-deeptest-py36-docker/1776/console
10:57:05
======================================================================
10:57:05 FAIL: test_access_denied_no_username
(tests.api_tests.TestLazyLoginNoUsername)
10:57:05 Test the query without a username.
10:57:05
----------------------------------------------------------------------
10:57:05 Traceback (most recent call last):
10:57:05 File "/usr/lib/python3.6/unittest/mock.py", line 1183, in patched
10:57:05 return func(*args, **keywargs)
10:57:05 File "/src/tests/api_tests.py", line 900, in
test_access_denied_no_username
10:57:05 'You have no API read permissions. Seems you are not logged
in.')
10:57:05 File "/usr/lib/python3.6/unittest/mock.py", line 805, in
assert_called_with
10:57:05 raise AssertionError('Expected call: %s\nNot called' %
(expected,))
10:57:05 AssertionError: Expected call: error('You have no API read
permissions. Seems you are not logged in.')
10:57:05 Not called
10:57:05
10:57:05
======================================================================
10:57:05 FAIL: test_access_denied_notexist_username
(tests.api_tests.TestLazyLoginNotExistUsername)
10:57:05 Test the query with a username which does not exist.
10:57:05
----------------------------------------------------------------------
10:57:05 Traceback (most recent call last):
10:57:05 File "/usr/lib/python3.6/unittest/mock.py", line 1183, in patched
10:57:05 return func(*args, **keywargs)
10:57:05 File "/src/tests/api_tests.py", line 875, in
test_access_denied_notexist_username
10:57:05 'You have no API read permissions. Seems you are not logged
in.')
10:57:05 File "/usr/lib/python3.6/unittest/mock.py", line 814, in
assert_called_with
10:57:05 raise AssertionError(_error_message()) from cause
10:57:05 AssertionError: Expected call: error('You have no API read
permissions. Seems you are not logged in.')
10:57:05 Actual call: error('Login failed (FAIL).')
10:57:05
There are several exception catched by the tests if slightly modified:
if 'tokens' not in meta and 'continue' not in self._params:
try:
self.site.mw_version >= '1.25wmf5'
except Exception as e:
print('###>')
print(str(e))
print('###<', e.__class__.__name__)
raise e
self._params.setdefault('rawcontinue', [''])
Here is the result:
D:\pwb\GIT\core>pwb api_tests -v TestLazyLoginNotExistUsername
tests: max_retries reduced from 15 to 1
test_access_denied_notexist_username
(__main__.TestLazyLoginNotExistUsername.test_access_denied_notexist_username)
Test the query with a username which does not exist. ... ###>
readapidenied: You need read permission to use this module.
[servedby: mw1394;
help: See https://steward.wikimedia.org/w/api.php for API usage. Subscribe
to the mediawiki-api-announce mailing list at
<https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/>
for notice of API deprecations and breaking changes.]
###< APIError
###>
Username "Not registered username" does not have read permissions on
steward:steward
.You have made too many recent login attempts.
Please wait 5 minutes before trying again.
###< NoUsernameError
###>
readapidenied: You need read permission to use this module.
[servedby: mw1390;
help: See https://steward.wikimedia.org/w/api.php for API usage. Subscribe
to the mediawiki-api-announce mailing list at
<https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/>
for notice of API deprecations and breaking changes.]
###< APIError
ok
----------------------------------------------------------------------
Ran 1 test in 1.266s
OK
See also T284577 <https://phabricator.wikimedia.org/T284577>
TASK DETAIL
https://phabricator.wikimedia.org/T320247
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: Aklapper, JJMC89, Xqt, pywikibot-bugs-list, PotsdamLamb, Jyoo1011,
JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS,
Mdupont, Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]