Files
cibuildwheel/test/test_ssl.py
T
Henry Schreiner 3fa7bd1e72 ci: fix cirrus and reduce rebuilds (#2460)
* ci: fix Cirrus CI on Windows

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: skip unrelated changes more often

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-10 17:57:25 -04:00

35 lines
982 B
Python

import socket
import textwrap
from . import test_projects, utils
project_with_ssl_tests = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
r"""
import ssl
from urllib.request import urlopen
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
# badssl.com is a HTTPS test server that can be used to test SSL connections
data = urlopen("https://tls-v1-2.badssl.com", context=context)
data = urlopen("https://tls-v1-2.badssl.com")
"""
)
)
def test(tmp_path):
# this test checks that SSL is working in the build environment using
# some checks in setup.py.
project_dir = tmp_path / "project"
project_with_ssl_tests.generate(project_dir)
# warm up connection
socket.getaddrinfo("tls-v1-2.badssl.com", 443)
actual_wheels = utils.cibuildwheel_run(project_dir)
expected_wheels = utils.expected_wheels("spam", "0.1.0")
assert set(actual_wheels) == set(expected_wheels)