Page MenuHomePhabricator

Travis fails on site_tests.SiteSysopTestCase
Closed, ResolvedPublic

Description

https://travis-ci.org/wikimedia/pywikibot/jobs/640945614#L3812

======================================================================

ERROR: test_deletedrevs (tests.site_tests.SiteSysopTestCase)

Test the site.deletedrevs() method.

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/wikimedia/pywikibot/tests/site_tests.py", line 1925, in test_deletedrevs

    for dr in gen:

  File "/home/travis/build/wikimedia/pywikibot/pywikibot/site.py", line 5039, in deletedrevs

    raise Error(err + 'access deleted revisions.')

Error: deletedrevs: User:Pywikibot-test not authorized to access deleted revisions.
______________________ SiteSysopTestCase.test_deletedrevs ______________________

self = <tests.site_tests.SiteSysopTestCase testMethod=test_deletedrevs>

    def test_deletedrevs(self):

        """Test the site.deletedrevs() method."""

        mysite = self.get_site()

        mainpage = self.get_mainpage()

        gen = mysite.deletedrevs(total=10, titles=mainpage)

    

>       for dr in gen:

tests/site_tests.py:1925: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = APISite("en", "wikipedia"), titles = Page(Main Page), start = None

end = None, reverse = False, content = False, total = 10, kwargs = {}

handle_props = <function handle_props at 0x7fc2b38d7320>

err = 'deletedrevs: User:Pywikibot-test not authorized to '

    @deprecated_args(step=None, get_text='content', page='titles',

                     limit='total')

    def deletedrevs(self, titles=None, start=None, end=None, reverse=False,

                    content=False, total=None, **kwargs):

        """Iterate deleted revisions.

    

        Each value returned by the iterator will be a dict containing the

        'title' and 'ns' keys for a particular Page and a 'revisions' key

        whose value is a list of revisions in the same format as

        recentchanges plus a 'content' element with key '*' if requested

        when 'content' parameter is set. For older wikis a 'token' key is

        also given with the content request.

    

        @see: U{https://www.mediawiki.org/wiki/API:Deletedrevisions}

    

        @param titles: The page titles to check for deleted revisions

        @type titles: str (multiple titles delimited with '|')

            or pywikibot.Page or typing.Iterable[pywikibot.Page]

            or typing.Iterable[str]

        @keyword revids: Get revisions by their ID

    

        @note either titles or revids must be set but not both

    

        @param start: Iterate revisions starting at this Timestamp

        @param end: Iterate revisions ending at this Timestamp

        @param reverse: Iterate oldest revisions first (default: newest)

        @type reverse: bool

        @param content: If True, retrieve the content of each revision

        @param total: number of revisions to retrieve

        @keyword user: List revisions by this user

        @keyword excludeuser: Exclude revisions by this user

        @keyword tag: Only list revision tagged with this tag

        @keyword prop: Which properties to get. Defaults are ids, user,

            comment, flags and timestamp

        """

        def handle_props(props):

            """Translate deletedrev props to deletedrevisions props."""

            if isinstance(props, UnicodeType):

                props = props.split('|')

            if self.mw_version >= '1.25':

                return props

    

            old_props = []

            for item in props:

                if item == 'ids':

                    old_props += ['revid', 'parentid']

                elif item == 'flags':

                    old_props.append('minor')

                elif item == 'timestamp':

                    pass

                else:

                    old_props.append(item)

                    if item == 'content' and self.mw_version < '1.24':

                        old_props.append('token')

            return old_props

    

        if start and end:

            self.assert_valid_iter_params('deletedrevs', start, end, reverse)

    

        if not self.logged_in():

            self.login()

    

        err = ('deletedrevs: User:{} not authorized to '

               .format(self.user()))

        if 'deletedhistory' not in self.userinfo['rights']:

>           raise Error(err + 'access deleted revisions.')

E           Error: deletedrevs: User:Pywikibot-test not authorized to access deleted revisions.

pywikibot/site.py:5039: Error

------------------------------ Captured log setup ------------------------------

logging.py                 109 VERBOSE  Found 1 wikipedia:en processes running, including this one.

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript
Xqt triaged this task as High priority.Jan 25 2020, 11:53 AM

There should a way implemented to login with a sysop account at travis. Not sure whether we have one but I guess we had it.
I've no access to the pwb config at travis anymore due to unknown reason :-(

If you are a member of WIkimedia GitHub team and have 2FA turned on at GitHub, you should have access to Travis

If you are a member of WIkimedia GitHub team and have 2FA turned on at GitHub, you should have access to Travis

I have both I thought see T222095

Weird, you should be able to access. Have you tried to remove Travis from Applications (all tabs) in GitHub settings and recreate rights for Travis? Have you tried to clear cache of your browser?

Weird, you should be able to access. Have you tried to remove Travis from Applications (all tabs) in GitHub settings and recreate rights for Travis? Have you tried to clear cache of your browser?

It's a problem with MS Edge. I hate windoof 10

Neither Pywikibot-test, nor Pywikibot-oauth has got sysop rights anywhere currently.

Change 572894 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix] Skip tests if user right missing

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

Change 572894 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Skip tests if user right missing

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

There should a way implemented to login with a sysop account at travis. Not sure whether we have one but I guess we had it.
I've no access to the pwb config at travis anymore due to unknown reason :-(

I created T245851

Dvorapa claimed this task.
Dvorapa moved this task from Backlog to Test failures on the Pywikibot-tests board.