Tests fail on Python 3.12: `ssl.wrap_socket` removed

Open Beginner friendly
#1,302 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
testing-qa

Research direction

Start with tests/core/lib/test_ssl.py::TestSslMethod::test_create_tcp_socket and tests/core/lib/test_socket.py::TestSocketMethod::test_create_tcp_socket, then inspect how each test patches ssl.wrap_socket. Update the tests to use an API supported by Python 3.12 while preserving their existing assertions, and run both tests across the supported Python versions.

Written by the indexing model from the issue text.

Description

Two tests fail on Python 3.12 because they patch ssl.wrap_socket, which was removed in Python 3.12:

  • tests/core/lib/test_ssl.py::TestSslMethod::test_create_tcp_socket
  • tests/core/lib/test_socket.py::TestSocketMethod::test_create_tcp_socket

Error message:

AttributeError: <module 'ssl' from '.../python3.12/ssl.py'> does not have the attribute 'wrap_socket'

I believe this is mainly because Python 3.12 removed the deprecated ssl.wrap_socket() API (deprecated since 3.7).

Environment:
Python 3.12.8
Project supports Python 3.10–3.12 per pyproject.toml (python = "^3.10, <3.13") and docs

Dominant language
Python
Stars
5.6k
Forks
1.2k
Avg merge
1d 21h
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OWASP/Nettacker

All issues in OWASP/Nettacker

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.