MCPcopy Index your code
hub / github.com/python/cpython / run_amock

Function run_amock

Lib/test/test_wsgiref.py:69–81  ·  view source on GitHub ↗
(app=hello_app, data=b"GET / HTTP/1.0\n\n")

Source from the content-addressed store, hash-verified

67
68
69def run_amock(app=hello_app, data=b"GET / HTTP/1.0\n\n"):
70 server = make_server("", 80, app, MockServer, MockHandler)
71 inp = BufferedReader(BytesIO(data))
72 out = BytesIO()
73 olderr = sys.stderr
74 err = sys.stderr = StringIO()
75
76 try:
77 server.finish_request((inp, out), ("127.0.0.1",8888))
78 finally:
79 sys.stderr = olderr
80
81 return out.getvalue(), err.getvalue()
82
83
84def compare_generic_iter(make_it, match):

Callers 9

test_plain_helloMethod · 0.85
test_environMethod · 0.85
test_request_lengthMethod · 0.85
test_validated_helloMethod · 0.85
test_wsgi_inputMethod · 0.85
test_bytes_validationMethod · 0.85
test_cp1252_urlMethod · 0.85

Calls 7

getvalueMethod · 0.95
make_serverFunction · 0.90
BufferedReaderClass · 0.90
BytesIOClass · 0.90
StringIOClass · 0.90
finish_requestMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…