Skip to content

test_listen_trio fails #35

Description

@amezin

When I try to run tests locally, trio test fails:

$ dbus-run-session -- nox -s test-3.9
nox > Running session test-3.9
nox > Re-using existing virtual environment at .nox/test-3-9.
nox > python -m pip install .[test]
nox > pytest --cov --cov-config setup.cfg --cov-report=html:/home/amezin/dbus-objects/.nox/test-3-9/htmlcov --cov-report=xml:/home/amezin/dbus-objects/.nox/test-3-9/coverage-3.9.xml tests/
============================================================================================================ test session starts =============================================================================================================
platform linux -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/amezin/dbus-objects
plugins: trio-0.7.0, subtests-0.5.0, cov-2.12.1, asyncio-0.15.1
collected 61 items                                                                                                                                                                                                                           

tests/test_base_server.py ......                                                                                                                                                                                                       [  9%]
tests/test_jeepney.py ...                                                                                                                                                                                                              [ 14%]
tests/test_jeepney_trio.py .E                                                                                                                                                                                                          [ 18%]
tests/test_object.py .............                                                                                                                                                                                                     [ 39%]
tests/test_signature.py .....................................                                                                                                                                                                          [100%]

=================================================================================================================== ERRORS ===================================================================================================================
_____________________________________________________________________________________________________ ERROR at setup of test_listen_trio _____________________________________________________________________________________________________

    @pytest.fixture()
    async def jeepney_trio_router():
>       async with jeepney.io.trio.open_dbus_router(bus='SESSION') as router:

tests/test_jeepney_trio.py:40: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.9/contextlib.py:175: in __aenter__
    return await self.gen.__anext__()
.nox/test-3-9/lib/python3.9/site-packages/jeepney/io/trio.py:417: in open_dbus_router
    conn = await open_dbus_connection(bus, enable_fds=enable_fds)
.nox/test-3-9/lib/python3.9/site-packages/jeepney/io/trio.py:195: in open_dbus_connection
    sock : trio.SocketStream = await trio.open_unix_socket(bus_addr)
.nox/test-3-9/lib/python3.9/site-packages/trio/_highlevel_open_unix_stream.py:45: in open_unix_socket
    sock = socket(AF_UNIX, SOCK_STREAM)
.nox/test-3-9/lib/python3.9/site-packages/trio/_socket.py:281: in socket
    sf = _socket_factory.get(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = RunVar(_name='socket_factory', _default=<object object at 0x7f8276909880>), default = None

    def get(self, default=_NO_DEFAULT):
        """Gets the value of this :class:`RunVar` for the current run call."""
        try:
            return _run.GLOBAL_RUN_CONTEXT.runner._locals[self]
        except AttributeError:
>           raise RuntimeError("Cannot be used outside of a run context") from None
E           RuntimeError: Cannot be used outside of a run context

.nox/test-3-9/lib/python3.9/site-packages/trio/_core/_local.py:41: RuntimeError

----------- coverage: platform linux, python 3.9.6-final-0 -----------
Coverage HTML written to dir /home/amezin/dbus-objects/.nox/test-3-9/htmlcov
Coverage XML written to file /home/amezin/dbus-objects/.nox/test-3-9/coverage-3.9.xml

========================================================================================================== short test summary info ===========================================================================================================
ERROR tests/test_jeepney_trio.py::test_listen_trio - RuntimeError: Cannot be used outside of a run context
======================================================================================================== 60 passed, 1 error in 0.98s =========================================================================================================
nox > Command pytest --cov --cov-config setup.cfg --cov-report=html:/home/amezin/dbus-objects/.nox/test-3-9/htmlcov --cov-report=xml:/home/amezin/dbus-objects/.nox/test-3-9/coverage-3.9.xml tests/ failed with exit code 1
nox > Session test-3.9 failed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions