]> code.delx.au - proxy/commitdiff
Write server output to log file when running tests
authorJames Bunton <jamesbunton@delx.net.au>
Tue, 22 Sep 2015 22:25:34 +0000 (08:25 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Tue, 22 Sep 2015 22:25:34 +0000 (08:25 +1000)
.gitignore
test_proxy.py

index df078234bd61ff195a85849f37f71b25085b0d60..d188b2122a4237d9797ab608cf4a7284b432bf11 100644 (file)
@@ -1,2 +1,3 @@
 socks5server
 .*.swp
 socks5server
 .*.swp
+out.log
index b9d4f81096a8c33ae9cf79abae3a3b7f1cd507c2..68743d2c4834e59b2887c405b3bf4838a0ec0063 100755 (executable)
@@ -370,13 +370,13 @@ class SocksServer(object):
         self.env = {}
         self.env["LISTEN_PORT"] = str(SOCKS_PORT)
         self.env.update(extra_env)
         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"],
 
     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,
         )
 
             env=self.env,
         )
 
@@ -385,7 +385,7 @@ class SocksServer(object):
         return self
 
     def __exit__(self, exc_type, exc_val, exc_tb):
         return self
 
     def __exit__(self, exc_type, exc_val, exc_tb):
-        self.devnull.close()
+        self.log_output.close()
         self.process.terminate()
         self.process.wait()
 
         self.process.terminate()
         self.process.wait()