jenkins-bot merged this change.
[bugfix] let Site('test', 'test) be equal to Site('test', 'wikipedia')
- update family_tests.py
- also show the deprecation warning as FutureWarning so that
test family can be removed soon.
Bug: T228839
Change-Id: I1f06723699de24b7dfdfba1cc68f601b0922b7c8
---
M pywikibot/families/test_family.py
M tests/family_tests.py
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/pywikibot/families/test_family.py b/pywikibot/families/test_family.py
index 51b4480..afa55b4 100644
--- a/pywikibot/families/test_family.py
+++ b/pywikibot/families/test_family.py
@@ -1,23 +1,18 @@
# -*- coding: utf-8 -*-
"""Family module for test.wikipedia.org."""
#
-# (C) Pywikibot team, 2007-2019
+# (C) Pywikibot team, 2007-2020
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
-from pywikibot.families.wikipedia_family import Family
+from pywikibot.families.wikipedia_family import Family # noqa: F401
from pywikibot.tools import issue_deprecation_warning
issue_deprecation_warning(
- 'test_family', 'wikipedia_family', since='20190718')
-# Also remove the ``if fam == 'test':`` condition in pywikibot.__init__
+ 'test_family', 'wikipedia_family', since='20190718',
+ warning_class=FutureWarning)
+# Also remove the ``if fam == 'test':`` condition in pywikibot.__init__.py
+# and `` == 'test':`` condition in tests.family_tests.py
# whenever this module is removed.
-
-
-class Family(Family):
-
- """Family class for test.wikipedia.org."""
-
- name = 'test'
diff --git a/tests/family_tests.py b/tests/family_tests.py
index 28c5007..f127794 100644
--- a/tests/family_tests.py
+++ b/tests/family_tests.py
@@ -51,7 +51,10 @@
self.assertIsInstance(domain, basestring)
if domain.split(':', 1)[0] != 'localhost':
self.assertIn('.', domain)
- self.assertEqual(f.name, name)
+ if name == 'test':
+ self.assertEqual(f.name, 'wikipedia')
+ else:
+ self.assertEqual(f.name, name)
with suppress_warnings(
'wowwiki_family.Family.languages_by_size '
@@ -176,7 +179,10 @@
self.assertEqual(args, ())
self.assertEqual(kwargs, {})
self.assertEqual(code, self.current_code)
- self.assertEqual(fam, self.current_family)
+ if self.current_family == 'test':
+ self.assertEqual(fam, 'wikipedia')
+ else:
+ self.assertEqual(fam, self.current_family)
site = DrySite(code, fam, None)
site._siteinfo._cache['general'] = ({'articlepath': self.article_path},
True)
To view, visit change 572250. To unsubscribe, or for help writing mail filters, visit settings.