Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1289305?usp=email )

Change subject: [bugfix] override all Sites of test_codes in 
RecentChangesTestCase
......................................................................

[bugfix] override all Sites of test_codes in RecentChangesTestCase

Sites with test coded have very rare recent changes as well as
event streams. Therefore override all default sites with test codes
and not only test or test2.

Also remove the temporary patch in EventStreamsPageGeneratorTestCase.

Bug: T426540
Change-Id: I05ef2145fcc776e0cb76a89035c273e984e7db70
---
M tests/aspects.py
M tests/pagegenerators_tests.py
2 files changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/tests/aspects.py b/tests/aspects.py
index 965826b..234172c 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1521,15 +1521,20 @@

     @classmethod
     def setUpClass(cls) -> None:
-        """Set up test class."""
+        """Set up test class.
+
+        .. version-changed:: 11.4
+           Override the default site for all test sites.
+        """
         if os.environ.get('PYWIKIBOT_TEST_NO_RC', '0') == '1':
             raise unittest.SkipTest(
                 'PYWIKIBOT_TEST_NO_RC is set; RecentChanges tests disabled.')

         super().setUpClass()

-        if cls.get_site().code in ('test', 'test2'):
-            cls.override_default_site(pywikibot.Site('en', 'wikipedia'))
+        site = cls.get_site()
+        if site.code in site.family.test_codes:
+            cls.override_default_site(pywikibot.Site('wikipedia:en'))


 class DeprecationTestCase(TestCase):
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index dc85bbc..9b2cd1d 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1662,13 +1662,6 @@

     """Test case for Live Recent Changes pagegenerator."""

-    @classmethod
-    def setUpClass(cls) -> None:
-        """Skip wikisource:beta site due to T426540."""
-        super().setUpClass()
-        if cls.site.sitename == 'wikisource:beta':
-            cls.skipTest(cls, f'Skip {cls.site} site due to T426540')
-
     def test_RC_pagegenerator_result(self) -> None:
         """Test RC pagegenerator."""
         site = self.get_site()

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1289305?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I05ef2145fcc776e0cb76a89035c273e984e7db70
Gerrit-Change-Number: 1289305
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to