XZise has uploaded a new change for review.
https://gerrit.wikimedia.org/r/183312
Change subject: [FIX] Pagegen test: Allow same chars anywhere
......................................................................
[FIX] Pagegen test: Allow same chars anywhere
The test_regexfilter_default test requires that a page begins with the
same character at least twice. This is obviously not possible on
wikidata because all main namespace pages begin with Q and a digit which
are never the same. Thus the test never ends because it can't find 10
pages. This removes the requirement that the first two chracters need to
be the same, although this could still cause freezes if a wiki is very
small and doesn't contain 10 pages which have at least the same
character twice.
Those tests aren't executed by travis with wikidata configured so it
doesn't happen there currently.
Change-Id: I312334bc202894c7eb224c5f46ec32b725c2c961
---
M tests/pagegenerators_tests.py
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/12/183312/1
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index b11432f..7ffe7a1 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -471,15 +471,15 @@
def test_regexfilter_default(self):
gf = pagegenerators.GeneratorFactory()
- # Matches titles with the same two or more starting letters
- self.assertTrue(gf.handleArg('-titleregex:^(.)\\1+'))
+ # Matches titles with the same two or more continous characters
+ self.assertTrue(gf.handleArg('-titleregex:(.)\\1+'))
gf.handleArg('-limit:10')
gen = gf.getCombinedGenerator()
pages = list(gen)
self.assertLessEqual(len(pages), 10)
for page in pages:
self.assertIsInstance(page, pywikibot.Page)
- self.assertRegex(page.title().lower(), '^(.)\\1+')
+ self.assertRegex(page.title().lower(), '(.)\\1+')
def test_regexfilter_ns(self):
raise unittest.SkipTest('This test takes over 10 minutes due to
T85389')
--
To view, visit https://gerrit.wikimedia.org/r/183312
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I312334bc202894c7eb224c5f46ec32b725c2c961
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits