jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/808415 )
Change subject: [test] Decrease number of tests in test_two_continuations_limited ......................................................................
[test] Decrease number of tests in test_two_continuations_limited
- Reduce number of tests in TestPropertyGenerator.test_two_continuations_limited; this decreases test time by 25% - use tuple for links and a generator for titles - test that processed pagedata is less or equal to 'total' links - test that processed pagedata is more than half of 'total' links
Bug: T311348 Change-Id: Ibeed1a090522f78ce85a71ef61c8372e7bfe9391 --- M tests/api_tests.py 1 file changed, 10 insertions(+), 4 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py index 0a1390c..be3a6e4 100755 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -609,14 +609,17 @@
def test_two_continuations_limited(self): """Test PropertyGenerator with many limited props and continuations.""" + total = 20 + increment = total // 4 mainpage = self.get_mainpage() - links = list(self.site.pagelinks(mainpage, total=30)) - titles = [link.title(with_section=False) for link in links] + links = tuple(self.site.pagelinks(mainpage, total=total)) + titles = (link.title(with_section=False) for link in links) gen = api.PropertyGenerator( - site=self.site, prop='info|categoryinfo|langlinks|templates', + site=self.site, + prop='info|categoryinfo|langlinks|templates', parameters={'titles': '|'.join(titles)}) # Force the generator into continuation mode - gen.set_query_increment(5) + gen.set_query_increment(increment)
count = 0 for count, pagedata in enumerate(gen, start=1): @@ -626,6 +629,9 @@ else: self.assertIn('pageid', pagedata) self.assertLength(links, count) + self.assertGreaterEqual(total, count) + # ensure we have enough continuations + self.assertGreater(count, total // 2 + 1)
class TestDryQueryGeneratorNamespaceParam(TestCase):
pywikibot-commits@lists.wikimedia.org