GoogleChromeLabs / pywebsocket3

BSD 3-Clause "New" or "Revised" License
44 stars 32 forks source link

Rename module mod_pywebsocket to pywebsocket3 #33

Closed whimboo closed 9 months ago

whimboo commented 9 months ago

To release the package on PyPI (#30) the module has to be renamed to pywebsocket3.

@ricea can you please have a look? Please note that not all tests are passing right now but that also happens on master, so it's not a regression from this PR.

Failures:

....................................[2023-11-07 11:04:27,524] [WARNING] mod_pywebsocket.request_handler.WebSocketRequestHandler: 127.0.0.1 - code 404, message File not found
....E.......................................WARNING 11:04:29 stream.py:253] Payload length is not encoded using the minimal number of bytes (1 is encoded using 8 bytes)
......................./Users/henrik/code/pywebsocket3/test/../mod_pywebsocket/msgutil.py:126: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
../Users/henrik/code/pywebsocket3/test/../mod_pywebsocket/msgutil.py:189: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
................../Users/henrik/.pyenv/versions/3.10.11/lib/python3.10/random.py:370: DeprecationWarning: non-integer arguments to randrange() have been deprecated since Python 3.10 and will be removed in a subsequent version
  return self.randrange(a, b+1)
...................../Users/henrik/code/pywebsocket3/test/test_mock.py:88: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
..........
======================================================================
ERROR: test_unmasked_frame (test_endtoend.EndToEndHyBiTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/henrik/code/pywebsocket3/test/../test/client_for_testing.py", line 710, in assert_connection_closed
    error_number, message = e
TypeError: cannot unpack non-iterable ConnectionResetError object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/henrik/code/pywebsocket3/test/test_endtoend.py", line 295, in test_unmasked_frame
    self._run_test(_unmasked_frame_check_procedure)
  File "/Users/henrik/code/pywebsocket3/test/test_endtoend.py", line 226, in _run_test
    self._run_test_with_options(test_function, self._options)
  File "/Users/henrik/code/pywebsocket3/test/test_endtoend.py", line 219, in _run_test_with_options
    test_function(client)
  File "/Users/henrik/code/pywebsocket3/test/test_endtoend.py", line 115, in _unmasked_frame_check_procedure
    client.assert_connection_closed()
  File "/Users/henrik/code/pywebsocket3/test/../test/client_for_testing.py", line 716, in assert_connection_closed
    raise e
  File "/Users/henrik/code/pywebsocket3/test/../test/client_for_testing.py", line 703, in assert_connection_closed
    read_data = receive_bytes(self._socket, 1)
  File "/Users/henrik/code/pywebsocket3/test/../test/client_for_testing.py", line 136, in receive_bytes
    new_received_bytes = socket.recv(remaining)
ConnectionResetError: [Errno 54] Connection reset by peer
ricea commented 9 months ago

Sorry for the delayed response. I want to figure out why the tests are failing and hopefully fix them before landing this.

whimboo commented 9 months ago

@ricea would you need some help in figuring that out?

whimboo commented 9 months ago

@ricea I've added a new commit which fixes the problem. Reason here is that the ConnectionError class doesn't have a message attribute and as such unpack failed. Now all the tests are passing.

ricea commented 9 months ago

Thanks! Greatly appreciated!

whimboo commented 9 months ago

Very very nice. lgtm. Before I land it, do you have any ideas how to make the transition easier for downstream users? I guess they can just do s/mod_pywebsocket/pywebsocket3/ so it shouldn't be a huge burden.

Did you ever thought about using GitHub actions to run the tests? It would be much safer to rely on the CI results when code is getting updated. But it may not block the release?

ricea commented 9 months ago

Did you ever thought about using GitHub actions to run the tests? It would be much safer to rely on the CI results when code is getting updated. But it may not block the release?

In the past we used Travis CI but that's not permitted for Google orgs any more.