Skip to content

Example: 'async_generator' object has no attribute 'server_info' error #84

@jakubmatyszewski

Description

@jakubmatyszewski

Hello,

So I wanted to try motor, thus was looking at this repo and unfortunately after running the example I received following error:

============================= test session starts ==============================
platform linux -- Python 3.10.8, pytest-7.1.3, pluggy-1.0.0
rootdir: /app, configfile: pytest.ini
plugins: motor-0.3.0, asyncio-0.19.0, anyio-3.6.1
asyncio: mode=strict
collected 1 item

tests/test_db.py F                                                       [100%]

=================================== FAILURES ===================================
___________________________ test_using_motor_client ____________________________

motor_client = <async_generator object motor_client at 0xffff939ca240>

    @pytest.mark.asyncio
    async def test_using_motor_client(motor_client: AsyncIOMotorClient) -> None:
        """This test has access to a Motor client."""
>       await motor_client.server_info()
E       AttributeError: 'async_generator' object has no attribute 'server_info'

tests/test_db.py:9: AttributeError
=========================== short test summary info ============================
FAILED tests/test_db.py::test_using_motor_client - AttributeError: 'async_gen...
============================== 1 failed in 0.07s ===============================
sys:1: RuntimeWarning: coroutine 'mongod_binary' was never awaited
sys:1: RuntimeWarning: coroutine 'root_directory' was never awaited

Besides AttributeError: 'async_generator' object has no attribute 'server_info' I wonder why these 2 warnings pop up.

Any guidance in understanding this issue is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions