Skip to content
Myr

Tested TestServer multiple request handling

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Braulio Valdivielso Martínez · committed by Braulio Valdivielso Martínez · parent 4a41c59 · Browse files · 1 file+17 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+17 added−0 removed

  • other:+17 added−0 removed

1 file+17 added−0 removed

modified:test_requests.py+17 added
1815 unmodified lines
1816 time.sleep(2.5)1817 sock.send(b'still alive')1818 block_server.set() # release server block18191820 def test_multiple_requests(self):1821 requests_to_handle = 51822 1823 server = Server.basic_response_server(requests_to_handle=requests_to_handle)18241825 with server as (host, port):1826 server_url = 'http://{}:{}'.format(host, port)1827 for _ in range(requests_to_handle):1828 r = requests.get(server_url)1829 assert r.status_code == 20018301831 # the (n+1)th request fails1832 with pytest.raises(requests.exceptions.ConnectionError):1833 r = requests.get(server_url)1834183518361837if __name__ == '__main__':1838 unittest.main()