jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/516333 )
Change subject: [bugfix] Refactor TestObsoleteSite
......................................................................
[bugfix] Refactor TestObsoleteSite
- use DefaultSiteTestCase and instantiate a Site in each test method
- use suppress_warnings if needed instead of mocking setUpClass
- take into account that closed sites has a ClosedSite interface
Bug: T225459
Change-Id: I97c2e4dabcacf74d5abfbf3bee84f8a0200b8fd8
---
M tests/site_tests.py
1 file changed, 8 insertions(+), 35 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 6c177b5..e94296e 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -3349,48 +3349,19 @@
self.assertFalse(site.sametitle('Invalid:Foo', 'Invalid:foo'))
-class TestObsoleteSite(TestCase):
+class TestObsoleteSite(DefaultSiteTestCase):
"""Test 'closed' and obsolete code sites."""
- # hostname() fails, so it is provided here otherwise the
- # test class fails with hostname not defined for mh.wikipedia.org
- sites = {
- 'mhwp': {
- 'family': 'wikipedia',
- 'code': 'mh',
- 'hostname': 'mh.wikipedia.org',
- },
- # pywikibot should never attempt to access jp.wikipedia.org,
- # however this entry ensures that there is a change in the builds
- # if jp.wikipedia.org goes offline.
- 'jpwp': {
- 'family': 'wikipedia',
- 'code': 'jp',
- 'hostname': 'jp.wikipedia.org',
- },
- 'jawp': {
- 'family': 'wikipedia',
- 'code': 'ja',
- },
- }
-
- @classmethod
- def setUpClass(cls):
- """Setup the class."""
- with patch.object(pywikibot, 'warn') as warn_mock:
- super(TestObsoleteSite, cls).setUpClass()
- warn_mock.assert_called_once_with(
- 'Site wikipedia:ja instantiated using different code "jp"',
- UserWarning, 2)
-
def test_locked_site(self):
"""Test Wikimedia closed/locked site."""
- site = self.get_site('mhwp')
+ with suppress_warnings('Interwiki removal mh is in wikipedia codes'):
+ site = pywikibot.Site('mh', 'wikipedia')
+ self.assertIsInstance(site, pywikibot.site.ClosedSite)
self.assertEqual(site.code, 'mh')
self.assertIsInstance(site.obsolete, bool)
self.assertTrue(site.obsolete)
- self.assertIsNotNone(site.hostname)
+ self.assertEqual(site.hostname(), 'mh.wikipedia.org')
r = http.fetch(uri='http://mh.wikipedia.org/w/api.php',
default_error_handling=False)
self.assertEqual(r.status, 200)
@@ -3408,7 +3379,9 @@
def test_alias_code_site(self):
"""Test Wikimedia site with an alias code."""
- site = self.get_site('jpwp')
+ with suppress_warnings(
+ 'Site wikipedia:ja instantiated using different code "jp"'):
+ site = pywikibot.Site('jp', 'wikipedia')
self.assertIsInstance(site.obsolete, bool)
self.assertEqual(site.code, 'ja')
self.assertFalse(site.obsolete)
--
To view, visit https://gerrit.wikimedia.org/r/516333
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I97c2e4dabcacf74d5abfbf3bee84f8a0200b8fd8
Gerrit-Change-Number: 516333
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Whym <whym(a)whym.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/517169 )
Change subject: [bugfix] Remove several sites from wikipedia closed_wikis list
......................................................................
[bugfix] Remove several sites from wikipedia closed_wikis list
Remove advisory, quality, strategy, usability from closed_wikis list;
they where never part of the wikipedia family (wikipedia.org) but
hat their own site in wikimedia.org domain.
Change-Id: Iba75ef3cfa9c63ecaa6cb142325c75748d4eaa9d
---
M pywikibot/families/wikipedia_family.py
1 file changed, 5 insertions(+), 4 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikipedia_family.py b/pywikibot/families/wikipedia_family.py
index a20e19a..536a434 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -18,13 +18,14 @@
name = 'wikipedia'
closed_wikis = [
- # See https://noc.wikimedia.org/conf/highlight.php?file=dblists/closed.dblist # noqa
- 'aa', 'advisory', 'cho', 'ho', 'hz', 'ii', 'kj', 'kr', 'mh', 'mus',
- 'ng', 'quality', 'strategy', 'ten', 'usability'
+ # See:
+ # https://noc.wikimedia.org/conf/highlight.php?file=dblists/closed.dblist
+ 'aa', 'cho', 'ho', 'hz', 'ii', 'kj', 'kr', 'mh', 'mus', 'ng', 'ten',
]
removed_wikis = [
- # See https://noc.wikimedia.org/conf/highlight.php?file=dblists/deleted.dblist # noqa
+ # See:
+ # https://noc.wikimedia.org/conf/highlight.php?file=dblists/deleted.dblist
'dk', 'ru-sib', 'tlh', 'tokipona', 'zh_cn', 'zh_tw',
]
--
To view, visit https://gerrit.wikimedia.org/r/517169
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iba75ef3cfa9c63ecaa6cb142325c75748d4eaa9d
Gerrit-Change-Number: 517169
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/517030 )
Change subject: test(test_login_logout): fix AssertionError
......................................................................
test(test_login_logout): fix AssertionError
Follow up to c4fbf0c, two consecutive logouts does not raise
AssertionError anymore.
It was somewhat wrong to rely on this error anyway, because assert
statements are not reliable in Python (they are skipped when the
-O is passed to the interpreter.)
Change-Id: Ie4e99ef80b022c527865fd703b33dee4654b8ae9
---
M tests/site_tests.py
1 file changed, 1 insertion(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index d4baea1..63d5cc2 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -3718,9 +3718,7 @@
self.assertEqual(site._loginstatus, loginstatus.NOT_LOGGED_IN)
self.assertNotIn('_userinfo', site.__dict__.keys())
- self.assertRaisesRegexp(AssertionError,
- 'User must login in this site',
- site.logout)
+ self.assertIsNone(site.user())
if __name__ == '__main__': # pragma: no cover
--
To view, visit https://gerrit.wikimedia.org/r/517030
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie4e99ef80b022c527865fd703b33dee4654b8ae9
Gerrit-Change-Number: 517030
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/516638 )
Change subject: [tests] Skip test gracefully if i18n package is missing
......................................................................
[tests] Skip test gracefully if i18n package is missing
Bug: T225632
Change-Id: I2f588752ae86a410203ff5b722a8e35b14523032
---
M tests/l10n_tests.py
1 file changed, 8 insertions(+), 4 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/l10n_tests.py b/tests/l10n_tests.py
index 52bb522..d063f3a 100644
--- a/tests/l10n_tests.py
+++ b/tests/l10n_tests.py
@@ -61,10 +61,6 @@
return test_template
# create test methods for package messages processed by unittest
- if not i18n.messages_available():
- raise unittest.SkipTest("i18n messages package '{}' not available."
- .format(i18n._messages_package_name))
-
site = pywikibot.Site(dct['code'], dct['family'])
codes = site.family.languages_by_size
del site
@@ -92,6 +88,14 @@
family = 'wikipedia'
code = 'en'
+ @classmethod
+ def setUpClass(cls):
+ """Skip test gracefully if i18n package is missing."""
+ super(TestValidTemplate, cls).setUpClass()
+ if not i18n.messages_available():
+ raise unittest.SkipTest("i18n messages package '{}' not available."
+ .format(i18n._messages_package_name))
+
class TestSites(TestCase):
--
To view, visit https://gerrit.wikimedia.org/r/516638
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2f588752ae86a410203ff5b722a8e35b14523032
Gerrit-Change-Number: 516638
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)