irmen / Pyro5

Pyro 5 - Python remote objects
https://pyro5.readthedocs.io
MIT License
303 stars 36 forks source link

Test failing with pypy3 #83

Closed ceamac closed 10 months ago

ceamac commented 10 months ago

This test passes with python 3.10, 3.11 and 3.12, but fails with pypy3:

======================================================================================================================================== FAILURES ========================================================================================================================================
____________________________________________________________________________________________________________________________ TestServerOnce.testRegisterWeak _____________________________________________________________________________________________________________________________

self = <test_server.TestServerOnce object at 0x00007ff6de479718>

    def testRegisterWeak(self):
        obj=ServerTestObject()
        uri=self.daemon.register(obj,weak=True)
        with Pyro5.client.Proxy(uri) as p:
            result = p.getDict()
            assert isinstance(result, dict), "getDict() is proxied normally"
            del obj # weak registration should not prevent the obj from being garbage-collected
>           with pytest.raises(Pyro5.errors.DaemonError):
E           Failed: DID NOT RAISE <class 'Pyro5.errors.DaemonError'>

p          = <Pyro5.client.Proxy at 0x7ff6de870a68; not connected; for PYRO:obj_5467f01ee33242ea8452da7ee0f3dae6@localhost:33395; owner <greenlet.greenlet object at 0x00007ff6de5b18e0>>
result     = {'number': 42}
self       = <test_server.TestServerOnce object at 0x00007ff6de479718>
uri        = <Pyro5.core.URI at 0x7ff6de8710c0; PYRO:obj_5467f01ee33242ea8452da7ee0f3dae6@localhost:33395>

tests/test_server.py:462: Failed
==================================================================================================================================== warnings summary ====================================================================================================================================
tests/test_naming.py::TestOfflineNameServerTestsSqlStorage::testNAT
  /usr/lib/pypy3.10/site-packages/pluggy/_callers.py:127: ResourceWarning: unclosed <socket.socket fd=16, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
    for teardown in reversed(teardowns):

tests/test_naming.py::TestOfflineNameServerTestsSqlStorage::testNAT
  /usr/lib/pypy3.10/site-packages/pluggy/_callers.py:127: ResourceWarning: unclosed <socket.socket fd=18, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
    for teardown in reversed(teardowns):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================================================ short test summary info =================================================================================================================================
FAILED tests/test_server.py::TestServerOnce::testRegisterWeak - Failed: DID NOT RAISE <class 'Pyro5.errors.DaemonError'>
$ pypy3 -V
Python 3.10.13 (f1607341da97ff5a1e93430b6e8c4af0ad1aa019, Oct 19 2023, 13:58:10)
[PyPy 7.3.13 with GCC 13.2.1 20231014]
irmen commented 10 months ago

As the test succeeds on every other CPython version, I'm going to assume this is a pypy issue. In the past I've added a few work arounds here and there for pypy, but I've stopped spending time on that. I don't think it's likely you'll encounter this issue anyway.

ceamac commented 10 months ago

I guess it's an implementation detail (probably related to the GC). Looks harmless. I'll close the issue. Thanks!