From fd873fa0a5a402574d723b1d0a0b4c6ab4d0df0a Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 11 Apr 2021 13:24:10 +0200 Subject: [PATCH] httpserver: Don't serve_forever when documenting 1. it binds the port, which is useless while documenting 2. in some circumstances, it prevents supybot-plugin-doc from exiting (because the server threads are still running) --- src/httpserver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/httpserver.py b/src/httpserver.py index c3421c3ed..97a6f8ab8 100644 --- a/src/httpserver.py +++ b/src/httpserver.py @@ -446,12 +446,13 @@ class RealSupyHTTPServer(HTTPServer): class TestSupyHTTPServer(RealSupyHTTPServer): def __init__(self, *args, **kwargs): self.callbacks = {} + self.server_address = ("0.0.0.0", 0) def serve_forever(self, *args, **kwargs): pass def shutdown(self, *args, **kwargs): pass -if world.testing: +if world.testing or world.documenting: SupyHTTPServer = TestSupyHTTPServer else: SupyHTTPServer = RealSupyHTTPServer