Page MenuHomePhabricator

assertDeprecationFile is failing for TestPageDeprecation.test_creator
Closed, ResolvedPublic

Description

Only appears in job 19 of travis builds.

https://travis-ci.org/wikimedia/pywikibot-core/jobs/222770095

_______________________ TestPageDeprecation.test_creator _______________________

self = <tests.page_tests.TestPageDeprecation testMethod=test_creator>

    def test_creator(self):

        """Test getCreator."""

        mainpage = self.get_mainpage()

        creator = mainpage.getCreator()

        self.assertEqual(creator,

                         (mainpage.oldest_revision.user,

                          mainpage.oldest_revision.timestamp.isoformat()))

        self.assertIsInstance(creator[0], unicode)

        self.assertIsInstance(creator[1], unicode)

>       self.assertDeprecation()

tests/page_tests.py:570: 

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

tests/aspects.py:1588: in assertDeprecation

    self.assertDeprecationFile(self.expect_warning_filename)

tests/aspects.py:1631: in assertDeprecationFile

    % (filename, item))

E   AssertionError: expected warning filename /home/travis/build/wikimedia/pywikibot-core/tests/page_tests.py; warning item: {message : ResourceWarning("unclosed <socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.17.0.7', 53744), raddr=('208.80.154.224', 443)>",), category : 'ResourceWarning', filename : '/opt/python/3.4.2/lib/python3.4/socket.py', lineno : 444, line : None}

Event Timeline

Change 348746 had a related patch set uploaded (by Dalba):
[pywikibot/core@master] page_tests.py: Fix resource warning in test_creator

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

This is another instance of T151248. Apparently requests session is not closed and causes ResourceWarning, See https://github.com/kennethreitz/requests/issues/1882.

We either have to ignore the warning or close the session manually. https://gerrit.wikimedia.org/r/348746 tries to do the latter.

Change 348746 abandoned by Dalba:
page_tests.py: Fix resource warning in test_creator

Reason:
I don't fully understand the underlying issue. Why session.close needs to be called both before and after each fetch? We might be better off ignoring the warning.

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

Change 348759 had a related patch set uploaded (by Dalba):
[pywikibot/core@master] page_tests.py: Ignore unknown warning packages in test_creator

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

Change 348759 merged by jenkins-bot:
[pywikibot/core@master] page_tests.py: Ignore unknown warning packages in test_creator

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