jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/768231 )

Change subject: [bugfix] fix assertPagesInNamespacesAll method
......................................................................

[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(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



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 https://gerrit.wikimedia.org/r/c/pywikibot/core/+/768231
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I842b1f0868430f2332145f773c16c05d576de453
Gerrit-Change-Number: 768231
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to