summaryrefslogtreecommitdiffhomepage
path: root/test/test_proxy.py
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-02-04 11:39:34 +0300
committerMax Romanov <max.romanov@nginx.com>2020-02-04 11:39:34 +0300
commit81b39d0b35d78daabf479ccd492ae8323039b7cb (patch)
tree53708f86c3e46dc9813aaf56d38cbe2fb486c0c8 /test/test_proxy.py
parent7c38650cd12b9d5b14aec5d416fa3b57918cee50 (diff)
downloadunit-81b39d0b35d78daabf479ccd492ae8323039b7cb.tar.gz
unit-81b39d0b35d78daabf479ccd492ae8323039b7cb.tar.bz2
Tests: fixing Python 3.8.1 errors on Mac.
- "Can't pickle local object ..." - "if __name__ == '__main__':" pattern required for multiprocessing
Diffstat (limited to 'test/test_proxy.py')
-rw-r--r--test/test_proxy.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py
index 4697b88f..5d158285 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -10,11 +10,12 @@ class TestProxy(TestApplicationPython):
SERVER_PORT = 7999
- def run_server(self):
+ @staticmethod
+ def run_server(server_port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- server_address = ('', self.SERVER_PORT)
+ server_address = ('', server_port)
sock.bind(server_address)
sock.listen(5)
@@ -57,7 +58,7 @@ Content-Length: 10
def setUp(self):
super().setUp()
- self.run_process(self.run_server)
+ self.run_process(self.run_server, self.SERVER_PORT)
self.waitforsocket(self.SERVER_PORT)
self.assertIn(