Giter Site home page Giter Site logo

Clean up tests on PyPy about websockets HOT 4 CLOSED

aaugustin avatar aaugustin commented on September 7, 2024
Clean up tests on PyPy

from websockets.

Comments (4)

aaugustin avatar aaugustin commented on September 7, 2024

Frequent warning:

~/.pyenv/versions/pypy3.10-7.3.16/lib/pypy3.10/asyncio/sslproto.py:320: ResourceWarning: unclosed transport <asyncio.sslproto._SSLProtocolTransport object at 0x...>

Test failure not linked to a specific test, but to the framework:

Traceback (most recent call last):
  File "/Users/myk/dev/websockets/tests/legacy/test_client_server.py", line 122, in _decorate
    return func(self, *_args, **_kwargs)
  File "/Users/myk/dev/websockets/tests/legacy/test_client_server.py", line 121, in _decorate
    with manager(self, *args, **kwargs):
  File "/Users/myk/.pyenv/versions/pypy3.10-7.3.16/lib/pypy3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/Users/myk/dev/websockets/tests/legacy/test_client_server.py", line 105, in temp_test_client
    test.start_client(*args, **kwargs)
  File "/Users/myk/dev/websockets/tests/legacy/test_client_server.py", line 331, in start_client
    super().start_client(path, **kwargs)
  File "/Users/myk/dev/websockets/tests/legacy/test_client_server.py", line 266, in start_client
    self.assertDeprecationWarnings(recorded_warnings, expected_warnings)
  File "/Users/myk/dev/websockets/tests/legacy/utils.py", line 80, in assertDeprecationWarnings
    self.assertEqual(type(recorded.message), DeprecationWarning)
AssertionError: <class 'ResourceWarning'> != <class 'DeprecationWarning'>

Failed run with that error: https://github.com/python-websockets/websockets/actions/runs/10316111205/job/28558214475

from websockets.

aaugustin avatar aaugustin commented on September 7, 2024

I doesn't make sense to spend much time fixing the test suite for the legacy implementation under PyPy, though.

from websockets.

aaugustin avatar aaugustin commented on September 7, 2024

This warning is a bug: python/cpython#90476

It was fixed in Python 3.11.

I tried to remove it by adding this to tests/__init__.py:

import warnings
warnings.filterwarnings(action="ignore", category=ResourceWarning)

This filters out ResourceWarning. I could confirm by raising a ResourceWarning just after this line. However, the warnings still get raised later in the tests. Probably something changes the warning filters inbetween. I just don't know what.

Removing warnings with command line arguments (pypy3.9 -W ignore:"unclosed transport":ResourceWarning:asyncio.sslproto -m unittest) works but that's quite annoying and hard to make conditional on the Python version. Very messy.

from websockets.

aaugustin avatar aaugustin commented on September 7, 2024

After 1853a9b tests are passing again on GitHub Actions — after a long string of non-passing tests. I couldn't get rid of the warning; I'll live with it.

from websockets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.