_________________ TestDeprecatedEditTokenFunctions.test_token __________________ self = <tests.site_tests.TestDeprecatedEditTokenFunctions testMethod=test_token> def test_token(self): """Test ability to get page tokens using site.tokens.""" token = self.token mysite = self.get_site() mainpage = self.get_mainpage() ttype = "edit" self.assertEqual(token, mysite.token(mainpage, ttype)) self.assertOneDeprecationParts('pywikibot.site.APISite.token', > "the 'tokens' property") tests/site_tests.py:2129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/aspects.py:1603: in assertOneDeprecationParts count) tests/aspects.py:1607: in assertOneDeprecation self.assertDeprecation(msg) tests/aspects.py:1594: in assertDeprecation self.assertDeprecationFile(self.expect_warning_filename) tests/aspects.py:1637: in assertDeprecationFile % (filename, item)) E AssertionError: expected warning filename /home/travis/build/wikimedia/pywikibot/tests/site_tests.py; warning item: {message : ResourceWarning("unclosed <socket.socket fd=8, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.17.0.3', 59372), raddr=('208.80.154.224', 443)>",), category : 'ResourceWarning', filename : '/opt/python/3.4.6/lib/python3.4/socket.py', lineno : 451, line : None}
Description
Description
Details
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[bugfix] Ignore unclosed socket warnings | pywikibot/core | master | +9 -0 |
Revisions and Commits
Revisions and Commits
rPWBC pywikibot | |||
rPWBCc50bcee3bcb1 [bugfix] Ignore unclosed socket warnings |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T152961 Improve tests suite | |||
Resolved | Xqt | T183696 site_tests.TestDeprecatedEditTokenFunctions.test_token failes sometimes with AssertionError due to unclosed socket.socket ResourceWarning |
Event Timeline
Comment Actions
Change 400228 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Ignore foreign package warnings
Comment Actions
This also occured in tests.site_tests.TestSiteObjectDeprecatedFunctions.test_allpages_filterredir_False
Maybe we should always ignore those socket warnings
Comment Actions
This seems to be a problem in requests package and they are doing it intentionally. See Lukasa comment on issue 3912.
Either that, or, if possible and easy enough, we should find a way to always close requests sessions properly.
Comment Actions
I did the first one because it was easier to solve instead of digging deeper to find the corresponding requests to close.
Comment Actions
Change 400228 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Ignore unclosed socket warnings