From: James Bunton Date: Tue, 22 Sep 2015 22:25:34 +0000 (+1000) Subject: Write server output to log file when running tests X-Git-Url: https://code.delx.au/proxy/commitdiff_plain/12f7690073e7f17d0c190fdff0229366e6744656 Write server output to log file when running tests --- diff --git a/.gitignore b/.gitignore index df07823..d188b21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ socks5server .*.swp +out.log diff --git a/test_proxy.py b/test_proxy.py index b9d4f81..68743d2 100755 --- a/test_proxy.py +++ b/test_proxy.py @@ -370,13 +370,13 @@ class SocksServer(object): self.env = {} self.env["LISTEN_PORT"] = str(SOCKS_PORT) self.env.update(extra_env) - self.devnull = open("/dev/null", "w") + self.log_output = open("out.log", "a") def __enter__(self): self.process = subprocess.Popen( args=["./socks5server"], - stdout=self.devnull, - stderr=self.devnull, + stdout=self.log_output, + stderr=self.log_output, env=self.env, ) @@ -385,7 +385,7 @@ class SocksServer(object): return self def __exit__(self, exc_type, exc_val, exc_tb): - self.devnull.close() + self.log_output.close() self.process.terminate() self.process.wait()