Page MenuHomePhabricator

namespace_tests.TestNamespaceDictDeprecated.test_resolve_exceptions tests failes for py3.4+
Closed, ResolvedPublic

Description

See https://travis-ci.org/wikimedia/pywikibot

=================================== FAILURES ===================================
_____________ TestNamespaceDictDeprecated.test_resolve_exceptions ______________
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

During handling of the above exception, another exception occurred:

self = <tests.namespace_tests.TestNamespaceDictDeprecated testMethod=test_resolve_exceptions>

    def test_resolve_exceptions(self):
        """Test Namespace.resolve failure."""
        self.assertRaisesRegex(TypeError, self.CONTAINSINAPPROPRIATE_RE,
                               Namespace.resolve, [True])
        self.assertRaisesRegex(TypeError, self.CONTAINSINAPPROPRIATE_RE,
                               Namespace.resolve, [False])
        self.assertRaisesRegex(TypeError, self.INTARGNOTSTRINGORNUMBER_RE,
>                              Namespace.resolve, [None])

tests/namespace_tests.py:281: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/aspects.py:1123: in inner_assert
    context = self.process_assert(assertion, *args, **kwargs)
tests/aspects.py:1111: in process_assert
    return assertion(*args, **kwargs)
E   AssertionError: "int\(\) argument must be a string or a number, not '(.*?)'" does not match "int() argument must be a string, a bytes-like object or a number, not 'NoneType'"

Event Timeline

Xqt triaged this task as High priority.Dec 10 2017, 1:06 PM

Expanding the regex with an alternative variant should fix it for now, until the older Python support won't be dropped.

@Xqt, thanks for raising this. Do we have an open task about errors such as this not being found by gerrit/jenkins?

@jayvdb, I don‘t think so. For non-trivial changes we should just wait for the quick test [1] and check whether any failures is affected by this patch before submitting.

[1] https://travis-ci.org/magul/pywikibot-core/builds

Do we have an open task about errors such as this not being found by gerrit/jenkins?

T132138: Perform full test suite using Wikimedia CI seems to be about this.

This should do the trick, patch is coming in 15 min.

https://regex101.com/r/oWPNET/2

Change 396930 had a related patch set uploaded (by Divadsn; owner: Divadsn):
[pywikibot/core@master] Fix regex in namespace_tests.py for py3.4

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

Change 396930 merged by jenkins-bot:
[pywikibot/core@master] Fix regex in namespace_tests.py for py3.4

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