Skip to content

Commit 83e9795

Browse files
committed
Ignore AttributeError when shutting down server
It's possible for the _server attribute to not exist if make_server raises an error in the constructor.
1 parent 0daabd7 commit 83e9795

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pytest_localserver/http.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ def __del__(self):
3131
self.stop()
3232

3333
def stop(self):
34-
self._server.shutdown()
34+
try:
35+
self._server.shutdown()
36+
except AttributeError:
37+
pass
3538

3639
@property
3740
def url(self):

0 commit comments

Comments
 (0)