Skip to content
Myr

Implemented test to verify that the context manager exits after the server is closed

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 f7917c3 · Browse files · 1 file+10 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+10 added−0 removed

  • other:+10 added−0 removed

1 file+10 added−0 removed

modified:test_requests.py+10 added
1754 unmodified lines
1755 text = sock.recv(1000)1756 assert text == answer1757 sock.close()17581759 def test_server_closes(self):1760 with Server.basic_response_server() as (host, port):1761 sock = socket.socket()1762 sock.connect((host, port))17631764 with pytest.raises(socket.error):1765 new_sock = socket.socket()1766 new_sock.connect((host, port))1767 sock.close()1768 1769 def test_basic_response(self):1770 with Server.basic_response_server() as (host, port):1771 r = requests.get('http://{}:{}'.format(host, port))1772 assert r.status_code == 200
5 unmodified lines