jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/485484 )
Change subject: [tests] Fix api_tests for wikia ......................................................................
[tests] Fix api_tests for wikia
- The warning message has been change. Check for "API warning (paraminfo): " only - skip test_valid_lagpattern if 'dbrepllag' is not in siteinfo
Bug: T214009 Change-Id: I1a04c5d227b30315ef946f392b937ce6393f81c7 --- M tests/api_tests.py 1 file changed, 6 insertions(+), 11 deletions(-)
Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py index 24464ff..d075dde 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -357,11 +357,8 @@ pi.fetch('foobar') self.assertRaises(KeyError, pi.__getitem__, 'foobar') self.assertRaises(KeyError, pi.__getitem__, 'foobar+foobar') - # The warning message does not end with a '.' in older MW versions. - self.assertIn( - 'API warning (paraminfo): ' - 'The module "main" does not have a submodule "foobar"', - w.call_args[0][0]) + # The warning message may be different with older MW versions. + self.assertIn('API warning (paraminfo): ', w.call_args[0][0])
self.assertNotIn('foobar', pi._paraminfo) self.assertIn('main', pi._paraminfo) @@ -389,11 +386,8 @@
with patch.object(pywikibot, 'warning') as w: self.assertRaises(KeyError, pi.__getitem__, 'query+foobar') - # The warning message does not end with a '.' in older MW versions. - self.assertIn( - 'API warning (paraminfo): ' - 'The module "query" does not have a submodule "foobar"', - w.call_args[0][0]) + # The warning message may be different with older MW versions. + self.assertIn('API warning (paraminfo): ', w.call_args[0][0])
self.assertRaises(KeyError, pi.submodules, 'edit')
@@ -1129,7 +1123,8 @@ def test_valid_lagpattern(self): """Test whether api.lagpattern is valid.""" mysite = self.get_site() - if mysite.siteinfo['dbrepllag'][0]['lag'] == -1: + if ('dbrepllag' not in mysite.siteinfo + or mysite.siteinfo['dbrepllag'][0]['lag'] == -1): raise unittest.SkipTest( '{0} is not running on a replicated database cluster.' .format(mysite)
pywikibot-commits@lists.wikimedia.org