jenkins-bot submitted this change.
[bugfix] fix assertPagesInNamespacesAll method
- only skip if namespaces from generated pages is a subset of
test namespaces
- use -namespace option to limit the retrieved namespaces
- use limit with -recentchanges:visualeditor option, otherwise
all occurences will be retrieved which can take a lot of time
Change-Id: I842b1f0868430f2332145f773c16c05d576de453
---
M tests/aspects.py
M tests/pagegenerators_tests.py
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/aspects.py b/tests/aspects.py
index b1b601a..0cc5949 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -222,10 +222,10 @@
page_namespaces = {page.namespace() for page in gen}
- if skip and page_namespaces != namespaces:
- raise unittest.SkipTest('Pages in namespaces {!r} not found.'
- .format(
- list(namespaces - page_namespaces)))
+ if skip and page_namespaces < namespaces:
+ raise unittest.SkipTest(
+ 'No pages in namespaces {} found.'
+ .format(list(namespaces - page_namespaces)))
self.assertEqual(page_namespaces, namespaces)
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index cf76c78..81f833f 100644
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1089,10 +1089,11 @@
def test_recentchanges_rctag(self):
"""Test recentchanges generator with recent changes tag."""
gf = pagegenerators.GeneratorFactory(site=self.site)
- gf.handle_arg('-recentchanges:visualeditor')
+ gf.handle_arg('-ns:0,2,4')
+ gf.handle_arg('-recentchanges:visualeditor,500')
gen = gf.getCombinedGenerator()
self.assertIsNotNone(gen)
- self.assertPagesInNamespacesAll(gen, {0, 1, 2}, skip=True)
+ self.assertPagesInNamespacesAll(gen, {0, 2, 4}, skip=True)
def test_recentchanges_default(self):
"""Test recentchanges generator with default namespace setting."""
@@ -1100,6 +1101,7 @@
self.skipTest('Skipping {} due to too many autoblocked users'
.format(self.site))
gf = pagegenerators.GeneratorFactory(site=self.site)
+ gf.handle_arg('-ns:0,1,2')
gf.handle_arg('-recentchanges:50')
gen = gf.getCombinedGenerator()
self.assertIsNotNone(gen)
To view, visit change 768231. To unsubscribe, or for help writing mail filters, visit settings.