File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 1- import os
21import contextlib
2+ import os
3+ import re
4+ import socket
35
46import pytest
57import requests
@@ -40,10 +42,22 @@ def test_server_should_be_http_1_1(httpbin):
4042 assert resp .startswith (b"HTTP/1.1" )
4143
4244
43- def test_dont_crash_on_certificate_problems (httpbin_secure ):
44- with pytest .raises (Exception ):
45+ def test_dont_crash_on_certificate_problems (httpbin_secure , capsys ):
46+ with socket .socket () as sock :
47+ sock .connect ((httpbin_secure .host , httpbin_secure .port ))
4548 # this request used to hang
46- requests .get (httpbin_secure + "/get" , verify = True , cert = __file__ )
49+ assert sock .recv (1 ) == b""
50+
51+ assert (
52+ re .match (
53+ r"pytest-httpbin server hit an exception serving request: .* The "
54+ "handshake operation timed out\n attempting to ignore so the rest "
55+ "of the tests can run\n " ,
56+ capsys .readouterr ().out ,
57+ )
58+ is not None
59+ )
60+
4761 # and this request would never happen
4862 requests .get (
4963 httpbin_secure + "/get" ,
You can’t perform that action at this time.
0 commit comments