From 3c9dce3d5f497ce33cf049d4b0f6d363c22f20ba Mon Sep 17 00:00:00 2001 From: xqt Date: Mon, 25 Nov 2024 12:50:19 +0100 Subject: [PATCH] tests: test TestInterwikidataBot.test_main for all sites Change-Id: I8fe175d80701003e12195aac0bbacb125165f0e4 --- tests/interwikidata_tests.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/interwikidata_tests.py b/tests/interwikidata_tests.py index 4780a65fdf..51b0f1cd91 100755 --- a/tests/interwikidata_tests.py +++ b/tests/interwikidata_tests.py @@ -13,7 +13,7 @@ import pywikibot from pywikibot import Link from scripts import interwikidata -from tests.aspects import SiteAttributeTestCase +from tests.aspects import AlteredDefaultSiteTestCase, SiteAttributeTestCase from tests.utils import empty_sites @@ -34,7 +34,7 @@ def try_to_add(self): return -class TestInterwikidataBot(SiteAttributeTestCase): +class TestInterwikidataBot(AlteredDefaultSiteTestCase, SiteAttributeTestCase): """Test Interwikidata.""" @@ -53,10 +53,13 @@ class TestInterwikidataBot(SiteAttributeTestCase): }, } - def test_main(self): + def test_main(self, key): """Test main function interwikidata.py.""" - # The default site is used here - if pywikibot.Site().has_data_repository: + site = self.get_site(key) + pywikibot.config.family = site.family + pywikibot.config.mylang = site.code + + if site.has_data_repository: with empty_sites(): # The main function return None. self.assertIsNone(interwikidata.main())