Unclosed errors in test_ssl on macOS on Python 3.10
❓ I'm submitting a ...
- [X] 🐞 bug report
- [ ] 🐣 feature request
- [ ] ❓ question about the decisions made in the repository
🐞 Describe the bug. What is the current behavior?
❓ What is the motivation / use case for changing the behavior?
💡 To Reproduce
Steps to reproduce the behavior:
$ python3 -mtox
💡 Expected behavior
Tests should pass.
📋 Details
# the tests can sporadically generate resource warnings
# due to timing issues
# all of these sporadic warnings appear to be about socket.socket
# and have been observed to come from requests connection pool
msg = str(warn.message)
if 'socket.socket' in msg:
pytest.xfail(
'\n'.join((
'Sometimes this test fails due to '
'a socket.socket ResourceWarning:',
msg,
)),
)
> pytest.fail(msg)
E Failed: unclosed <ssl.SSLSocket fd=16, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
...
Results (24.58s):
138 passed
5 failed
- cheroot/test/test_ssl.py:467 test_ssl_env[VerifyMode.CERT_NONE-True-builtin]
- cheroot/test/test_ssl.py:467 test_ssl_env[VerifyMode.CERT_NONE-False-builtin]
- cheroot/test/test_ssl.py:467 test_ssl_env[VerifyMode.CERT_OPTIONAL-True-builtin]
- cheroot/test/test_ssl.py:467 test_ssl_env[VerifyMode.CERT_OPTIONAL-False-builtin]
- cheroot/test/test_ssl.py:467 test_ssl_env[VerifyMode.CERT_REQUIRED-True-builtin]
7 xfailed
6 skipped
1 rerun
📋 Environment
- Cheroot version: main branch
- CherryPy version: X.X.X (if applicable)
- Python version: 3.10.4
- OS: macos 12.3.1
📋 Additional context
I get these same failures on my workstation.
When I run the tests on Python 3.9, I get a different failure, but none of those reported above.
It looks like maybe this issue was encountered in CI and suppressed there only (bff4985d1ade525a4f0fc9aea4c0bb7b8aef7572).
After expanding the xfail, the tests on Python 3.10 now fail the same as on 3.9 and 3.8.