Skip to content

Commit

Permalink
tests: test TestInterwikidataBot.test_main for all sites
Browse files Browse the repository at this point in the history
Change-Id: I8fe175d80701003e12195aac0bbacb125165f0e4
  • Loading branch information
xqt committed Nov 25, 2024
1 parent 284eae4 commit 3c9dce3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/interwikidata_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -34,7 +34,7 @@ def try_to_add(self):
return


class TestInterwikidataBot(SiteAttributeTestCase):
class TestInterwikidataBot(AlteredDefaultSiteTestCase, SiteAttributeTestCase):

"""Test Interwikidata."""

Expand All @@ -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())
Expand Down

0 comments on commit 3c9dce3

Please sign in to comment.