Xqt created this task.
Xqt added projects: Pywikibot, Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
Currently our test passes TestAlldeletedrevisionsAsUser. This is because our
test account hasn't deleted revisions. //Therefore our test should be skipped
if the data length is 0//.
//It would also be a good idea to use a for loop (maybe with subtests)
instead of `all` function// which is not explain the failure. Replacing the
second test with
## self.assertTrue(all('revisions' in data
## and isinstance(data['revisions'], dict)
## for data in drev))
for data in drev:
self.assertIn('revisions', data)
self.assertIsInstance(data['revisions'], dict)
and let `total=1` the result is shown as:
C:\pwb\GIT\core>py -3.9 pwb.py -user:xqbot site_tests -v
TestAlldeletedrevisionsAsUser.test_basic
tests: max_retries reduced from 15 to 1
test_basic (__main__.TestAlldeletedrevisionsAsUser)
Test the site.alldeletedrevisions() method. ... FAIL
======================================================================
FAIL: test_basic (__main__.TestAlldeletedrevisionsAsUser)
Test the site.alldeletedrevisions() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File ".\tests\site_tests.py", line 1623, in test_basic
self.assertIsInstance(data['revisions'], dict)
AssertionError: [{'revid': 214089678, 'parentid': 214089629, 'minor': '',
'user': 'Xqbot', 'timestamp': '2021-07-21T20:03:29Z'}] is not an instance of
<class 'dict'>
----------------------------------------------------------------------
Ran 1 test in 1.883s
FAILED (failures=1)
C:\pwb\GIT\core>
The data item here is
{'ns': 6,
'pageid': 0,
'revisions': [{'minor': '',
'parentid': 214089629,
'revid': 214089678,
'timestamp': '2021-07-21T20:03:29Z',
'user': 'Xqbot'}],
'title': 'Datei:Grabstein Peter Degner 1.jpg'}
----
The third test also fails completely. Using
## self.assertTrue(all('user' in rev
## and rev['user'] == mysite.user()
## for data in drev
## for rev in data))
for data in drev:
for rev in data:
self.assertIn('user', rev)
self.assertEqual(rev['user'], mysite.user())
gives the following result:
C:\pwb\GIT\core>py -3.9 pwb.py -user:xqbot site_tests -v
TestAlldeletedrevisionsAsUser.test_basic
tests: max_retries reduced from 15 to 1
test_basic (__main__.TestAlldeletedrevisionsAsUser)
Test the site.alldeletedrevisions() method. ... [{'ns': 6,
'pageid': 0,
'revisions': [{'minor': '',
'parentid': 214089629,
'revid': 214089678,
'timestamp': '2021-07-21T20:03:29Z',
'user': 'Xqbot'}],
'title': 'Datei:Grabstein Peter Degner 1.jpg'}]
FAIL
======================================================================
FAIL: test_basic (__main__.TestAlldeletedrevisionsAsUser)
Test the site.alldeletedrevisions() method.
----------------------------------------------------------------------
Traceback (most recent call last):
File ".\tests\site_tests.py", line 1630, in test_basic
self.assertIn('user', rev)
AssertionError: 'user' not found in 'pageid'
----------------------------------------------------------------------
Ran 1 test in 2.276s
FAILED (failures=1)
C:\pwb\GIT\core>
See also T287332 <https://phabricator.wikimedia.org/T287332>
TASK DETAIL
https://phabricator.wikimedia.org/T287393
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: JJMC89, Aklapper, atagar, Xqt, pywikibot-bugs-list, 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]