Page MenuHomePhabricator

several tests on Fandom are failing
Closed, DeclinedPublic

Event Timeline

Xqt triaged this task as High priority.Jan 17 2019, 6:44 AM

Change 485483 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [test] travis.yml: disable wikia tests

https://gerrit.wikimedia.org/r/485483

Change 485484 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [tests] Fix some api_tests for wikia

https://gerrit.wikimedia.org/r/485484

Change 485485 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [tests] Skip test_pages_with_property_generator test for wikia

https://gerrit.wikimedia.org/r/485485

I made two patches for this tasks but there are few remaining issues. I think they should be splitted in to subtasks.

Change 485485 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [tests] Skip test_pages_with_property_generator test for wikia

https://gerrit.wikimedia.org/r/485485

To be clear, this patch is trying to resolve the following traceback:

___________ TestFactoryGenerator.test_pages_with_property_generator ____________

self = <tests.pagegenerators_tests.TestFactoryGenerator testMethod=test_pages_with_property_generator>

    def test_pages_with_property_generator(self):
        """Test the pages_with_property_generator method."""
        mysite = self.get_site()
        for item in ('defaultsort', 'disambiguation', 'displaytitle',
                     'hiddencat', 'invalid_property'):
>           if item in mysite.get_property_names():

tests/pagegenerators_tests.py:1140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = APISite("wikia", "wikia"), args = (), kwargs = {}

    def callee(self, *args, **kwargs):
        if MediaWikiVersion(self.version()) < MediaWikiVersion(version):
            raise NotImplementedError(
                'Method or function "%s"\n'
                "isn't implemented in MediaWiki version < %s"
>               % (fn.__name__, version))
E           NotImplementedError: Method or function "get_property_names"
E           isn't implemented in MediaWiki version < 1.21

pywikibot/site.py:1369: NotImplementedError

Change 485485 merged by jenkins-bot:
[pywikibot/core@master] [tests] Skip test_pages_with_property_generator test for wikia

https://gerrit.wikimedia.org/r/485485

Change 485484 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [tests] Fix some api_tests for wikia

https://gerrit.wikimedia.org/r/485484

This patch is targetting the following failures:

'dbrepllag' is not in siteinfo:

_____________________ TestLagpattern.test_valid_lagpattern _____________________

self = <tests.api_tests.TestLagpattern testMethod=test_valid_lagpattern>

    def test_valid_lagpattern(self):
        """Test whether api.lagpattern is valid."""
        mysite = self.get_site()
>       if mysite.siteinfo['dbrepllag'][0]['lag'] == -1:

tests/api_tests.py:1132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/site.py:1651: in __getitem__
    return self.get(key, False)  # caches and doesn't force it
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pywikibot.site.Siteinfo object at 0x7f9de71818d0>, key = 'dbrepllag'
get_default = False, cache = True, expiry = False

    def get(self, key, get_default=True, cache=True, expiry=False):
        """
        Return a siteinfo property.
    
        It will never throw an APIError if it only stated, that the siteinfo
        property doesn't exist. Instead it will use the default value.
    
        @param key: The name of the siteinfo property.
        @type key: str
        @param get_default: Whether to throw an KeyError if the key is invalid.
        @type get_default: bool
        @param cache: Caches the result interally so that future accesses via
            this method won't query the server.
        @type cache: bool
        @param expiry: If the cache is older than the expiry it ignores the
            cache and queries the server to get the newest value.
        @type expiry: int/float (days), L{datetime.timedelta}, False (never)
        @return: The gathered property
        @rtype: various
        @raises KeyError: If the key is not a valid siteinfo property and the
            get_default option is set to False.
        @see: L{_get_siteinfo}
        """
        # expire = 0 (or timedelta(0)) are always expired and their bool is
        # False, so skip them EXCEPT if it's literally False, then they expire
        # never: "expiry is False" is different than "not expiry"!
        # if it's a int convert to timedelta
        if expiry is not False and isinstance(expiry, (int, float)):
            expiry = datetime.timedelta(expiry)
        if expiry or expiry is False:
            try:
                cached = self._get_cached(key)
            except KeyError:
                pass
            else:  # cached value available
                # is a default value, but isn't accepted
                if not cached[1] and not get_default:
                    raise KeyError(key)
                elif not Siteinfo._is_expired(cached[1], expiry):
                    return copy.deepcopy(cached[0])
        preloaded = self._get_general(key, expiry)
        if not preloaded:
            preloaded = self._get_siteinfo(key, expiry)[key]
        else:
            cache = False
        if not preloaded[1] and not get_default:
>           raise KeyError(key)
E           KeyError: u'dbrepllag'

API warning mismatches:

________________________ TestParamInfo.test_submodules _________________________

self = <tests.api_tests.TestParamInfo testMethod=test_submodules>

    def test_submodules(self):
        """Test another module apart from query having submodules."""
        pi = api.ParamInfo(self.site)
        self.assertFalse(pi._modules)
        pi.fetch(['query'])
        self.assertIn('query', pi._modules)
        self.assertIsInstance(pi._modules['query'], frozenset)
        self.assertIn('revisions', pi._modules['query'])
        self.assertEqual(pi.submodules('query'), pi.query_modules)
        for mod in pi.submodules('query', True):
            self.assertEqual(mod[:6], 'query+')
            self.assertEqual(mod[6:], pi[mod]['name'])
            self.assertEqual(mod, pi[mod]['path'])
    
        with patch.object(pywikibot, 'warning') as w:
            self.assertRaises(KeyError, pi.__getitem__, 'query+foobar')
        # The warning message does not end with a '.' in older MW versions.
        self.assertIn(
            'API warning (paraminfo): '
            'The module "query" does not have a submodule "foobar"',
>           w.call_args[0][0])
E       AssertionError: u'API warning (paraminfo): The module "query" does not have a submodule "foobar"' not found in u"API warning (paraminfo): Unrecognized value for parameter 'querymodules': foobar"

tests/api_tests.py:396: AssertionError
____________________ TestParamInfo.test_with_invalid_module ____________________

self = <tests.api_tests.TestParamInfo testMethod=test_with_invalid_module>

    def test_with_invalid_module(self):
        """Test requesting different kind of invalid modules."""
        site = self.get_site()
        pi = api.ParamInfo(site)
        self.assertEqual(len(pi), 0)
    
        with patch.object(pywikibot, 'warning') as w:
            pi.fetch('foobar')
            self.assertRaises(KeyError, pi.__getitem__, 'foobar')
            self.assertRaises(KeyError, pi.__getitem__, 'foobar+foobar')
        # The warning message does not end with a '.' in older MW versions.
        self.assertIn(
            'API warning (paraminfo): '
            'The module "main" does not have a submodule "foobar"',
>           w.call_args[0][0])
E       AssertionError: u'API warning (paraminfo): The module "main" does not have a submodule "foobar"' not found in u"API warning (paraminfo): Unrecognized value for parameter 'modules': foobar+foobar"

Change 485484 merged by jenkins-bot:
[pywikibot/core@master] [tests] Fix api_tests for wikia

https://gerrit.wikimedia.org/r/485484

Change 485483 abandoned by Xqt:
[test] travis.yml: disable wikia tests

Reason:
Not the best solution I think

https://gerrit.wikimedia.org/r/485483

Dvorapa renamed this task from several tests on wikia are failing to several tests on Fandom are failing.Mar 19 2020, 12:14 PM
Dvorapa lowered the priority of this task from High to Medium.
Dvorapa updated the task description. (Show Details)

Change 581574 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix] Don't forget to load default Site

https://gerrit.wikimedia.org/r/581574

Change 581574 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Don't expect default Site is in random sample

https://gerrit.wikimedia.org/r/581574

Change 582610 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix] Fix logout on older MW versions

https://gerrit.wikimedia.org/r/582610

Do we want to change pywikibot.site to make it work with Fandom family non-standard specialties? (like not supporting several MW 1.12+ API features?)

Or should we just skip ucnouser and auprop issues on Fandom wikis in tests?

Change 582610 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Fix logout on MW < 1.24

https://gerrit.wikimedia.org/r/582610

Do we want to change pywikibot.site to make it work with Fandom family non-standard specialties? (like not supporting several MW 1.12+ API features?)

Or should we just skip ucnouser and auprop issues on Fandom wikis in tests?