-
Notifications
You must be signed in to change notification settings - Fork 31
unclosed socket in python3 #55
Copy link
Copy link
Closed
Description
In a few unittests, I started getting unclosed socket errors.
I may be leveraging this in unintended ways, as I created a Server() object and start/stop it manually.
The issue seems to be on Py3 (3.6 to be exact) the call to stop() doesn't close the socket on wsgiref, if a request has been made to it already. (Related #28 )
I've adjusted my tests to invoke _server.socket.close() after calling _server.stop(). I'm not sure if this is necessary in all usage of this package. If so, it may make sense to adjust the stop() method to call socket.close()
https://github.com/kevin1024/pytest-httpbin/blob/master/pytest_httpbin/serve.py#L117-L118
def stop(self):
self._server.shutdown()
+ self._server.socket.close()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels