Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tests are broken on Python 3.8 #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Jenselme opened this issue Jul 13, 2019 · 6 comments · Fixed by #675
Closed

Tests are broken on Python 3.8 #648

Jenselme opened this issue Jul 13, 2019 · 6 comments · Fixed by #675
Labels

Comments

@Jenselme
Copy link

From what I saw, many tests break on Python 3.8 beta (118 as time of writing) because new DeprecationWarning are raised. One I spotted is class 'websockets.protocol.WebSocketCommonProtocol'> should be instaniated by asyncio internals only, please avoid its creation from user code which is not reported on Python 3.7. This causes the assertions on how many warnings are logged to fail.

I tested on the current master branch.

Since Python 3.8 is still in beta, I don't think this is urgent. I should be able to help on that if you want.

Original report: https://bugzilla.redhat.com/show_bug.cgi?id=1718208

@aaugustin
Copy link
Member

https://bugs.python.org/issue24885 comes back and bites me here...

@aaugustin aaugustin added the bug label Jul 14, 2019
@aaugustin
Copy link
Member

I asked for clarifications about these undocumented, backwards-incompatible changes in Python: https://bugs.python.org/issue37639

@Harmon758
Copy link
Contributor

For reference, StreamReaderProtocol was removed from the documentation with python/cpython@8be876e (https://bugs.python.org/issue33649, python/cpython#9192) and backported to Python 3.7 with python/cpython@512d710 (python/cpython#9377).

The DeprecationWarning was added with python/cpython@ad4ed87 (https://bugs.python.org/issue36806, python/cpython#13101).

@bsergean
Copy link

I am running in prod now with python-3.8b4 and everything works well, fyi.

When I run tests I get this other warning btw.

  /xxx/cobra/venv/lib/python3.8/site-packages/websockets/server.py:722: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
    await asyncio.wait(

@jayvdb
Copy link

jayvdb commented Oct 3, 2019

I am still encountering this Python 3.8.0~rc1 , with v8.0.2, and I dont see anything on master which would have fixed this.

8.0.2...master

In addition to the deprecation warnings breaking the tests, there are two other failures I am encountering - same test method test_server_shuts_down_during_connection_close in two classes.

======================================================================
FAIL: test_server_shuts_down_during_connection_close (tests.test_client_server.ClientServerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 299, in stop_client
    self.loop.run_until_complete(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/usr/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 114, in _decorate
    return func(self, *_args, **_kwargs)
  File "/usr/lib/python3.8/unittest/mock.py", line 1342, in patched
    return func(*newargs, **newkeywargs)
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 1205, in test_server_shuts_down_during_connection_close
    self.assertEqual(reply, "Hello!")
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 333, in temp_client
    yield
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 101, in temp_test_client
    test.stop_client()
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 303, in stop_client
    self.fail("Client failed to stop")
AssertionError: Client failed to stop

======================================================================
FAIL: test_server_shuts_down_during_connection_close (tests.test_client_server.SecureClientServerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 299, in stop_client
    self.loop.run_until_complete(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/usr/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 114, in _decorate
    return func(self, *_args, **_kwargs)
  File "/usr/lib/python3.8/unittest/mock.py", line 1342, in patched
    return func(*newargs, **newkeywargs)
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 1205, in test_server_shuts_down_during_connection_close
    self.assertEqual(reply, "Hello!")
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 333, in temp_client
    yield
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 101, in temp_test_client
    test.stop_client()
  File "/home/abuild/rpmbuild/BUILD/websockets-8.0.2/tests/test_client_server.py", line 303, in stop_client
    self.fail("Client failed to stop")
AssertionError: Client failed to stop

@aaugustin
Copy link
Member

@jayvdb This test no longer made sense since 7.0 I removed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants