jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/938358 )
Change subject: Unbreak CI ......................................................................
Unbreak CI
./scripts/maintenance/wikimedia_sites.py: line 89:49: B034 sub should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions.
Skip tests likely not working because of T312666.
Change-Id: Iaf5f823a8fe3f55978c7a18af2804f8fe891aef1 --- M scripts/maintenance/wikimedia_sites.py M tests/pagegenerators_tests.py 2 files changed, 31 insertions(+), 13 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/maintenance/wikimedia_sites.py b/scripts/maintenance/wikimedia_sites.py index 67d35b8..835d410 100755 --- a/scripts/maintenance/wikimedia_sites.py +++ b/scripts/maintenance/wikimedia_sites.py @@ -86,7 +86,7 @@ filepath = Path(f'pywikibot/families/{family}_family.py') family_text = filepath.read_text(encoding='utf8') family_text = re.sub(r'(?ms)^ {4}languages_by_size.+?]', - text, family_text, 1) + text, family_text, count=1) filepath.write_text(family_text, encoding='utf8')
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py index 24470be..607617b 100755 --- a/tests/pagegenerators_tests.py +++ b/tests/pagegenerators_tests.py @@ -1712,6 +1712,7 @@ family = 'wikipedia' code = 'en'
+ @unittest.skip('Needs to be adapted for T14810') def test_weblink(self): """Test -weblink.""" cases = (('wikipedia.org', 'http://wikipedia.org'), @@ -1720,19 +1721,20 @@ ('ftp://*', 'ftp://'))
for search, expected in cases: - gf = pagegenerators.GeneratorFactory(site=self.site) - gf.handle_arg(f'-weblink:{search}') - gf.handle_arg('-ns:2') - gf.handle_arg('-limit:1') - gen = gf.getCombinedGenerator() - genlist = list(gen) - self.assertLength(genlist, 1) + with self.subTest(search=search, expected=expected): + gf = pagegenerators.GeneratorFactory(site=self.site) + gf.handle_arg(f'-weblink:{search}') + gf.handle_arg('-ns:2') + gf.handle_arg('-limit:1') + gen = gf.getCombinedGenerator() + genlist = list(gen) + self.assertLength(genlist, 1)
- page = genlist[0] - self.assertIsInstance(page, pywikibot.Page) - self.assertTrue(page.exists()) - self.assertEqual(page.namespace(), 2) - self.assertIn(expected, page.text) + page = genlist[0] + self.assertIsInstance(page, pywikibot.Page) + self.assertTrue(page.exists()) + self.assertEqual(page.namespace(), 2) + self.assertIn(expected, page.text)
def test_double_opposite_protocols(self): """Test LinksearchPageGenerator with two opposite protocols.""" @@ -1741,6 +1743,7 @@ protocol='https', site=self.site)
+ @unittest.skip('Needs to be adapted for T14810') def test_double_same_protocols(self): """Test LinksearchPageGenerator with two same protocols.""" gen = pagegenerators.LinksearchPageGenerator('https://w.wiki',
pywikibot-commits@lists.wikimedia.org