summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorengn33r <engn33r@users.noreply.github.com>2021-08-14 16:53:17 -0400
committerengn33r <engn33r@users.noreply.github.com>2021-08-14 16:53:17 -0400
commit5f32b3c0cfb836c016ad2a5f6caeff2978a6a16f (patch)
treec8d6d57acefe5cbb7bc71fc1e151c5f1804b9f07
parent44bda04a4e61386bf6de7fec658dabb0407c952c (diff)
downloadwebsocket-client-5f32b3c0cfb836c016ad2a5f6caeff2978a6a16f.tar.gz
Improve usage of LOCAL_WS_SERVER_PORT
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--.github/workflows/codecoverage.yml2
-rw-r--r--websocket/tests/test_app.py2
-rw-r--r--websocket/tests/test_http.py2
-rw-r--r--websocket/tests/test_websocket.py10
5 files changed, 9 insertions, 9 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 67f6ac4..a798a59 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -18,7 +18,7 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- - name: Run local websockets echo server on port 8765 (code is for Python 3.7+)
+ - name: Run local websockets echo server on port ${{ env.LOCAL_WS_SERVER_PORT }} (code is for Python 3.7+)
run: |
pip3 install -U websockets asyncio
python3 websocket/tests/echo-server.py &
diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml
index 5c3d52a..37af479 100644
--- a/.github/workflows/codecoverage.yml
+++ b/.github/workflows/codecoverage.yml
@@ -12,7 +12,7 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: "3.9"
- - name: Run local websockets echo server on port 8765
+ - name: Run local websockets echo server on port ${{ env.LOCAL_WS_SERVER_PORT }}
run: |
pip3 install -U websockets asyncio
python3 websocket/tests/echo-server.py &
diff --git a/websocket/tests/test_app.py b/websocket/tests/test_app.py
index 9ec7e0d..c563395 100644
--- a/websocket/tests/test_app.py
+++ b/websocket/tests/test_app.py
@@ -74,7 +74,7 @@ class WebSocketAppTest(unittest.TestCase):
"""
WebSocketAppTest.keep_running_close = self.keep_running
- app = ws.WebSocketApp('ws://127.0.0.1:' + str(LOCAL_WS_SERVER_PORT), on_open=on_open, on_close=on_close, on_message=on_message)
+ app = ws.WebSocketApp('ws://127.0.0.1:' + LOCAL_WS_SERVER_PORT, on_open=on_open, on_close=on_close, on_message=on_message)
app.run_forever()
@unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled")
diff --git a/websocket/tests/test_http.py b/websocket/tests/test_http.py
index de595b5..cfd2bfe 100644
--- a/websocket/tests/test_http.py
+++ b/websocket/tests/test_http.py
@@ -125,7 +125,7 @@ class HttpTest(unittest.TestCase):
@unittest.skipUnless(TEST_WITH_LOCAL_SERVER, "Tests using local websocket server are disabled")
def testProxyConnect(self):
ws = websocket.WebSocket()
- ws.connect("ws://127.0.0.1:" + str(LOCAL_WS_SERVER_PORT), http_proxy_host="127.0.0.1", http_proxy_port="8899", proxy_type="http")
+ ws.connect("ws://127.0.0.1:" + LOCAL_WS_SERVER_PORT, http_proxy_host="127.0.0.1", http_proxy_port="8899", proxy_type="http")
ws.send("Hello, Server")
server_response = ws.recv()
self.assertEqual(server_response, "Hello, Server")
diff --git a/websocket/tests/test_websocket.py b/websocket/tests/test_websocket.py
index 32b21bc..8c9f4cc 100644
--- a/websocket/tests/test_websocket.py
+++ b/websocket/tests/test_websocket.py
@@ -338,7 +338,7 @@ class WebSocketTest(unittest.TestCase):
@unittest.skipUnless(TEST_WITH_LOCAL_SERVER, "Tests using local websocket server are disabled")
def testWebSocket(self):
- s = ws.create_connection("ws://127.0.0.1:" + str(LOCAL_WS_SERVER_PORT))
+ s = ws.create_connection("ws://127.0.0.1:" + LOCAL_WS_SERVER_PORT)
self.assertNotEqual(s, None)
s.send("Hello, World")
result = s.next()
@@ -353,7 +353,7 @@ class WebSocketTest(unittest.TestCase):
@unittest.skipUnless(TEST_WITH_LOCAL_SERVER, "Tests using local websocket server are disabled")
def testPingPong(self):
- s = ws.create_connection("ws://127.0.0.1:" + str(LOCAL_WS_SERVER_PORT))
+ s = ws.create_connection("ws://127.0.0.1:" + LOCAL_WS_SERVER_PORT)
self.assertNotEqual(s, None)
s.ping("Hello")
s.pong("Hi")
@@ -380,7 +380,7 @@ class WebSocketTest(unittest.TestCase):
@unittest.skipUnless(TEST_WITH_LOCAL_SERVER, "Tests using local websocket server are disabled")
def testWebSocketWithCustomHeader(self):
- s = ws.create_connection("ws://127.0.0.1:" + str(LOCAL_WS_SERVER_PORT),
+ s = ws.create_connection("ws://127.0.0.1:" + LOCAL_WS_SERVER_PORT,
headers={"User-Agent": "PythonWebsocketClient"})
self.assertNotEqual(s, None)
s.send("Hello, World")
@@ -391,7 +391,7 @@ class WebSocketTest(unittest.TestCase):
@unittest.skipUnless(TEST_WITH_LOCAL_SERVER, "Tests using local websocket server are disabled")
def testAfterClose(self):
- s = ws.create_connection("ws://127.0.0.1:" + str(LOCAL_WS_SERVER_PORT))
+ s = ws.create_connection("ws://127.0.0.1:" + LOCAL_WS_SERVER_PORT)
self.assertNotEqual(s, None)
s.close()
self.assertRaises(ws.WebSocketConnectionClosedException, s.send, "Hello")
@@ -402,7 +402,7 @@ class SockOptTest(unittest.TestCase):
@unittest.skipUnless(TEST_WITH_LOCAL_SERVER, "Tests using local websocket server are disabled")
def testSockOpt(self):
sockopt = ((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),)
- s = ws.create_connection("ws://127.0.0.1:" + str(LOCAL_WS_SERVER_PORT), sockopt=sockopt)
+ s = ws.create_connection("ws://127.0.0.1:" + LOCAL_WS_SERVER_PORT, sockopt=sockopt)
self.assertNotEqual(s.sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY), 0)
s.close()