Issue 28078: Silence resource warnings in test_socket (original) (raw)
Created on 2016-09-11 15:47 by xiang.zhang, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (8)
Author: Xiang Zhang (xiang.zhang) *
Date: 2016-09-11 15:47
test_aead_aes_gcm (test.test_socket.LinuxKernelCryptoAPI) ... /home/angwer/cpython/Lib/unittest/case.py:600: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_ALG, type=SocketKind.SOCK_SEQPACKET, proto=0> testMethod() skipped "('[Errno 2] No such file or directory', 'aead', 'gcm(aes)')" test_sendmsg_afalg_args (test.test_socket.LinuxKernelCryptoAPI) ... /home/angwer/cpython/Lib/unittest/case.py:600: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_ALG, type=SocketKind.SOCK_SEQPACKET, proto=0> testMethod() ok
Christian, after , there are 2 resource warnings in test_socket. test_socket.patch eliminates them.
Author: Christian Heimes (christian.heimes) *
Date: 2016-09-11 16:36
Thanks! The first fix looks good. For the second one I'd rather wrap the test body in a with statement:
def test_sendmsg_afalg_args(self):
sock = socket.socket(socket.AF_ALG, socket.SOCK_SEQPACKET, 0)
with sock:
with self.assertRaises(TypeError):
sock.sendmsg_afalg()
...
Author: Xiang Zhang (xiang.zhang) *
Date: 2016-09-11 16:40
It's your code. Do what you like. :)
Author: Roundup Robot (python-dev)
Date: 2016-09-11 17:50
New changeset c515bc3b29bf by Christian Heimes in branch 'default': Issue #28078: Silence resource warnings in test_socket. Initial patch by Xiang Zhang, thanks https://hg.python.org/cpython/rev/c515bc3b29bf
Author: Christian Heimes (christian.heimes) *
Date: 2016-09-11 17:50
Thanks for the report and your patch. Let's watch the build bot.
Author: Xiang Zhang (xiang.zhang) *
Date: 2016-09-11 18:01
Christian, you forget a : after else.
Author: Roundup Robot (python-dev)
Date: 2016-09-11 18:03
New changeset 8b655668c04f by Christian Heimes in branch 'default': Issue #28078: Add missing colon https://hg.python.org/cpython/rev/8b655668c04f
Author: Christian Heimes (christian.heimes) *
Date: 2016-09-11 18:06
Oh heck! I'm not sure what happened here. The test was passing locally. I can only assume that I accidentally modified the file between test run and commit.
History
Date
User
Action
Args
2022-04-11 14:58:36
admin
set
github: 72265
2016-09-12 02:36:52
xiang.zhang
set
status: open -> closed
resolution: fixed
stage: commit review -> resolved
2016-09-11 18:06:30
christian.heimes
set
messages: +
2016-09-11 18:03:54
python-dev
set
messages: +
2016-09-11 18:01:59
xiang.zhang
set
status: pending -> open
messages: +
2016-09-11 17:50:44
christian.heimes
set
status: open -> pending
messages: +
stage: patch review -> commit review
2016-09-11 17:50:04
python-dev
set
nosy: + python-dev
messages: +
2016-09-11 16:40:52
xiang.zhang
set
messages: +
2016-09-11 16:36:18
christian.heimes
set
messages: +
2016-09-11 15:48:03
xiang.zhang
set
files: + test_socket.patch
keywords: + patch
2016-09-11 15:47:32
xiang.zhang
create