From d5fecc34bd521cbaa7080b697d7745f4fabb4119 Mon Sep 17 00:00:00 2001 From: pared Date: Mon, 28 Jan 2019 21:20:14 +0100 Subject: [PATCH] test: httpd: add lock for server --- tests/utils/httpd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/utils/httpd.py b/tests/utils/httpd.py index 078004116..afe6eefd5 100644 --- a/tests/utils/httpd.py +++ b/tests/utils/httpd.py @@ -17,8 +17,11 @@ class ETagHandler(SimpleHTTPRequestHandler): SimpleHTTPRequestHandler.end_headers(self) -class StaticFileServer(): +class StaticFileServer: + __server_lock = threading.Lock() + def __init__(self): + self.__server_lock.acquire() self.httpd = HTTPServer(('localhost', 8000), ETagHandler) def __enter__(self): @@ -29,3 +32,4 @@ class StaticFileServer(): def __exit__(self, *args): self.httpd.shutdown() self.httpd.server_close() + self.__server_lock.release()