jenkins-bot submitted this change.
[bugfix] site_tests.TestAlldeletedrevisionsAsUser fails
This test only passed when the test user lacked any deleted revisions. This
both corrects that and provides more helpful output in the case of failures.
Bug: T287393
Change-Id: I5c04d8bc928472ceb15fc0f58130c2c20cabcff0
---
M tests/site_tests.py
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 56a9789..1ea2c8d 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1604,22 +1604,25 @@
def setUpClass(cls):
"""Skip test if necessary."""
super().setUpClass()
- if cls.site.mw_version < '1.34':
- cls.skipTest(cls, 'site.alldeletedrevisions() needs mw 1.34')
+ if cls.site.mw_version < '1.25':
+ cls.skipTest(cls, 'site.alldeletedrevisions() needs mw 1.25')
def test_basic(self):
"""Test the site.alldeletedrevisions() method."""
mysite = self.get_site()
drev = list(mysite.alldeletedrevisions(user=mysite.user(), total=10))
- self.assertTrue(all(isinstance(data, dict)
- for data in drev))
- self.assertTrue(all('revisions' in data
- and isinstance(data['revisions'], dict)
- for data in drev))
- self.assertTrue(all('user' in rev
- and rev['user'] == mysite.user()
- for data in drev
- for rev in data))
+
+ if not drev:
+ self.skipTest('No deleted revisions available')
+
+ for data in drev:
+ with self.subTest(data=data):
+ self.assertIsInstance(data, dict)
+ self.assertIn('revisions', data)
+ self.assertIsInstance(data['revisions'], list)
+
+ for rev in data['revisions']:
+ self.assertEqual(mysite.user(), rev.get('user'))
def test_namespaces(self):
"""Test the site.alldeletedrevisions() method using namespaces."""
@@ -1763,8 +1766,8 @@
def test_prefix(self):
"""Test the site.alldeletedrevisions() method with prefix."""
mysite = self.get_site()
- if mysite.mw_version < '1.34':
- self.skipTest('site.alldeletedrevisions() needs mw 1.34')
+ if mysite.mw_version < '1.25':
+ self.skipTest('site.alldeletedrevisions() needs mw 1.25')
for data in mysite.alldeletedrevisions(prefix='John', total=5):
self.assertIsInstance(data, dict)
To view, visit change 707869. To unsubscribe, or for help writing mail filters, visit settings.