]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
bytearray is a 2.6ism; use array.array("B") instead for 2.5 compatibility.
authorBen Darnell <ben@bendarnell.com>
Fri, 30 Dec 2011 22:47:21 +0000 (14:47 -0800)
committerBen Darnell <ben@bendarnell.com>
Fri, 30 Dec 2011 22:47:21 +0000 (14:47 -0800)
maint/test/websocket/run.sh
maint/test/websocket/tox.ini
tornado/websocket.py

index 2ca103e461ab627650d6415ab78f226a3ea09d03..d11870152b3a7860539ac15286e74bd492764112 100755 (executable)
@@ -12,15 +12,22 @@ set -e
 # build/update the virtualenvs
 tox
 
-.tox/py27/bin/python server.py --port=9001 &
+.tox/py25/bin/python server.py --port=9001 &
+PY25_SERVER_PID=$!
+
+.tox/py27/bin/python server.py --port=9002 &
 PY27_SERVER_PID=$!
 
-.tox/py32/bin/python server.py --port=9002 &
+.tox/py32/bin/python server.py --port=9003 &
 PY32_SERVER_PID=$!
 
 sleep 1
 
-.tox/py27/bin/python ./client.py --servers=Tornado/py27=ws://localhost:9001,Tornado/py32=ws://localhost:9002 "$@"
+.tox/py27/bin/python ./client.py --servers=Tornado/py25=ws://localhost:9001,Tornado/py27=ws://localhost:9002,Tornado/py32=ws://localhost:9003 "$@"
 
+kill $PY25_SERVER_PID
 kill $PY27_SERVER_PID
 kill $PY32_SERVER_PID
+wait
+
+echo "Tests complete. Output is in ./reports/servers/index.html"
\ No newline at end of file
index b85d9728387a2bdc21af0124c7432f0c3d94c29e..7b374a48be66b08bdad5f30ee87cd4a18283cca4 100644 (file)
@@ -2,7 +2,7 @@
 # to install autobahn and deal with 2to3 for the python3 version.
 # See run.sh for the real test runner.
 [tox]
-envlist = py27, py32
+envlist = py27, py32, py25
 setupdir=../../..
 
 [testenv]
index 3e23101899b79cc333acdac788580685b97d8120..ce8e41dd6ce76eb0ab9b959e54f8673c47d3fbcd 100644 (file)
@@ -13,6 +13,7 @@ communication between the browser and server.
 """
 # Author: Jacob Kristhammar, 2010
 
+import array
 import functools
 import hashlib
 import logging
@@ -455,11 +456,11 @@ class WebSocketProtocol8(WebSocketProtocol):
         self.stream.read_bytes(4, self._on_masking_key);
 
     def _on_masking_key(self, data):
-        self._frame_mask = bytearray(data)
+        self._frame_mask = array.array("B", data)
         self.stream.read_bytes(self._frame_length, self._on_frame_data)
 
     def _on_frame_data(self, data):
-        unmasked = bytearray(data)
+        unmasked = array.array("B", data)
         for i in xrange(len(data)):
             unmasked[i] = unmasked[i] ^ self._frame_mask[i % 4]
 
@@ -494,7 +495,7 @@ class WebSocketProtocol8(WebSocketProtocol):
                 self._fragmented_message_buffer = unmasked
 
         if self._final_frame:
-            self._handle_message(opcode, bytes_type(unmasked))
+            self._handle_message(opcode, unmasked.tostring())
 
         if not self.client_terminated:
             self._receive_frame()