Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test on 3.13 and pypy 3.10 #90

Merged
merged 13 commits into from
Sep 18, 2024
Merged
5 changes: 3 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3.12, pypy-3.8, pypy-3.9]
python-version: [3.8, 3.9, '3.10', 3.11, 3.12, 3.13, pypy-3.10]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
allow-prereleases: true
cache-dependency-path: |
pyproject.toml
setup.cfg
Expand Down
2 changes: 1 addition & 1 deletion pytest_httpbin/certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
def where():
"""Return the preferred certificate bundle."""
# vendored bundle inside Requests
return os.path.join(os.path.dirname(__file__), "certs", "cacert.pem")
return os.path.join(os.path.dirname(__file__), "certs", "client.pem")


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions pytest_httpbin/certs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated with 'python -m trustme'
30 changes: 0 additions & 30 deletions pytest_httpbin/certs/cacert.pem

This file was deleted.

26 changes: 0 additions & 26 deletions pytest_httpbin/certs/cert.pem

This file was deleted.

12 changes: 12 additions & 0 deletions pytest_httpbin/certs/client.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-----BEGIN CERTIFICATE-----
MIIB0TCCAXegAwIBAgIUScnyyX1CI+ywC6GdKol8IIwuGnkwCgYIKoZIzj0EAwIw
RDEbMBkGA1UECgwSdHJ1c3RtZSB2MS4xLjArZGV2MSUwIwYDVQQLDBxUZXN0aW5n
IENBICNBdXNVcWJaNG81d3pjb0tCMCAXDTAwMDEwMTAwMDAwMFoYDzMwMDAwMTAx
MDAwMDAwWjBEMRswGQYDVQQKDBJ0cnVzdG1lIHYxLjEuMCtkZXYxJTAjBgNVBAsM
HFRlc3RpbmcgQ0EgI0F1c1VxYlo0bzV3emNvS0IwWTATBgcqhkjOPQIBBggqhkjO
PQMBBwNCAARhrRi78wmZY28t3/y8MTDDCsi7Lzir4WaQm96gf4/9kSolBTFVDUvB
MkSC7Yged+2bWEzTRERZQLf88uiorUnAo0UwQzAdBgNVHQ4EFgQUHymIBJV4gCrA
qv+6Q9pSJFtd7PYwEgYDVR0TAQH/BAgwBgEB/wIBCTAOBgNVHQ8BAf8EBAMCAYYw
CgYIKoZIzj0EAwIDSAAwRQIgLf0sybmdbJoTIgZWrU1k11oecQbdkzh+3jFtNEFn
zYUCIQCRXjIBDZXtyaywk3DgIggByCQxrrB5vjlnyYTd9vNUSw==
-----END CERTIFICATE-----
3 changes: 0 additions & 3 deletions pytest_httpbin/certs/etc/README.md

This file was deleted.

18 changes: 0 additions & 18 deletions pytest_httpbin/certs/etc/certificate.conf

This file was deleted.

26 changes: 0 additions & 26 deletions pytest_httpbin/certs/etc/localhost.crt

This file was deleted.

18 changes: 0 additions & 18 deletions pytest_httpbin/certs/etc/localhost.csr

This file was deleted.

27 changes: 0 additions & 27 deletions pytest_httpbin/certs/etc/localhost.key

This file was deleted.

30 changes: 0 additions & 30 deletions pytest_httpbin/certs/etc/rootCA.crt

This file was deleted.

51 changes: 0 additions & 51 deletions pytest_httpbin/certs/etc/rootCA.key

This file was deleted.

1 change: 0 additions & 1 deletion pytest_httpbin/certs/etc/rootCA.srl

This file was deleted.

27 changes: 0 additions & 27 deletions pytest_httpbin/certs/key.pem

This file was deleted.

5 changes: 5 additions & 0 deletions pytest_httpbin/certs/server.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIPNMu1H1DN9x0VLZNzO3BFp5boEGyc80XFaR1ML18uFRoAoGCCqGSM49
AwEHoUQDQgAEiNIfYxmsmjemcRRpcd4qP+x1yONFBZZli7CEKxg9j3x5j1OJPeyC
BQ83kogrxJYLbRjdHUx4VOCEXjffmYhnMA==
-----END EC PRIVATE KEY-----
15 changes: 15 additions & 0 deletions pytest_httpbin/certs/server.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-----BEGIN CERTIFICATE-----
MIICTDCCAfOgAwIBAgIUZ9rBQX/YRZFcqXCIzOSAd1D0IUcwCgYIKoZIzj0EAwIw
RDEbMBkGA1UECgwSdHJ1c3RtZSB2MS4xLjArZGV2MSUwIwYDVQQLDBxUZXN0aW5n
IENBICNBdXNVcWJaNG81d3pjb0tCMCAXDTAwMDEwMTAwMDAwMFoYDzMwMDAwMTAx
MDAwMDAwWjBGMRswGQYDVQQKDBJ0cnVzdG1lIHYxLjEuMCtkZXYxJzAlBgNVBAsM
HlRlc3RpbmcgY2VydCAjLVdQNWpjLTllQ0U0S0JxMjBZMBMGByqGSM49AgEGCCqG
SM49AwEHA0IABIjSH2MZrJo3pnEUaXHeKj/sdcjjRQWWZYuwhCsYPY98eY9TiT3s
ggUPN5KIK8SWC20Y3R1MeFTghF4335mIZzCjgb4wgbswHQYDVR0OBBYEFCO99Ega
h7pEyFEJVwe09DZzNHDtMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUHymIBJV4
gCrAqv+6Q9pSJFtd7PYwLwYDVR0RAQH/BCUwI4IJbG9jYWxob3N0hwR/AAABhxAA
AAAAAAAAAAAAAAAAAAABMA4GA1UdDwEB/wQEAwIFoDAqBgNVHSUBAf8EIDAeBggr
BgEFBQcDAgYIKwYBBQUHAwEGCCsGAQUFBwMDMAoGCCqGSM49BAMCA0cAMEQCIHB0
imdD2aQuq4DipTvnFJjmT+w8i3D/Pz8X6bPdkJW/AiATl+m4TW4BE5v1ID3ftDhz
ja8s574nAjDAqcSL7otVpQ==
-----END CERTIFICATE-----
30 changes: 16 additions & 14 deletions pytest_httpbin/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,29 @@ def get_environ(self):


class SecureWSGIServer(WSGIServer):
def finish_request(self, request, client_address):
"""
Negotiates SSL and then mimics BaseServer behavior.
"""
request.settimeout(1.0)
def get_request(self):
socket, address = super().get_request()
try:
socket.settimeout(1.0)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(
os.path.join(CERT_DIR, "cert.pem"),
os.path.join(CERT_DIR, "key.pem"),
os.path.join(CERT_DIR, "server.pem"),
os.path.join(CERT_DIR, "server.key"),
)
return (
context.wrap_socket(
socket, server_side=True, suppress_ragged_eofs=True
),
address,
)
with context.wrap_socket(
request, server_side=True, suppress_ragged_eofs=False
) as ssock:
self.base_environ["HTTPS"] = "yes"
self.RequestHandlerClass(ssock, client_address, self)
except Exception as e:
print("pytest-httpbin server hit an exception serving request: %s" % e)
print("attempting to ignore so the rest of the tests can run")
# WSGIRequestHandler seems to close the socket for us.
# Thanks, WSGIRequestHandler!!
raise

def setup_environ(self):
super().setup_environ()
self.base_environ["HTTPS"] = "yes"


class Server:
Expand Down
Loading
Loading