The library just... doesn't work :/
I tried to use it with just the provided example and... it raises error
================================================================== test session starts ===================================================================
platform win32 -- Python 3.10.0, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: C:\Users\admin\Desktop\...
plugins: anyio-3.5.0, asyncio-0.17.2, motor-0.3.0
asyncio: mode=legacy
collected 1 item
tests\test_get_users.py F [100%]
======================================================================== FAILURES ========================================================================
________________________________________________________________ test_using_motor_client _________________________________________________________________
motor_client = AsyncIOMotorClient(MongoClient(host=['localhost:54224'], document_class=dict, tz_aware=False, connect=False, serverselectiontimeoutms=3000,
driver=DriverInfo(name='Motor', version='2.5.1', platform='asyncio')))
@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()
tests\test_get_users.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py:52: in run
result = self.fn(*self.args, **self.kwargs)
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pymongo\mongo_client.py:1994: in server_info
return self.admin.command("buildinfo",
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pymongo\database.py:757: in command
with self.__client._socket_for_reads(
C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\contextlib.py:135: in __enter__
return next(self.gen)
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pymongo\mongo_client.py:1387: in _socket_for_reads
server = self._select_server(read_preference, session)
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pymongo\mongo_client.py:1346: in _select_server
server = topology.select_server(server_selector)
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pymongo\topology.py:244: in select_server
return random.choice(self.select_servers(selector,
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pymongo\topology.py:202: in select_servers
server_descriptions = self._select_servers_loop(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Topology <TopologyDescription id: 61f848e5251fb5a778c86a17, topology_type: Single, servers: [<ServerDescription ('loc...ect('localhost:54224: [WinE
rror 10061] No connection could be made because the target machine actively refused it')>]>>
selector = Primary(), timeout = 3.0, address = None
def _select_servers_loop(self, selector, timeout, address):
"""select_servers() guts. Hold the lock when calling this."""
now = _time()
end_time = now + timeout
server_descriptions = self._description.apply_selector(
selector, address, custom_selector=self._settings.server_selector)
while not server_descriptions:
# No suitable servers.
if timeout == 0 or now > end_time:
> raise ServerSelectionTimeoutError(
"%s, Timeout: %ss, Topology Description: %r" %
(self._error_message(selector), timeout, self.description))
E pymongo.errors.ServerSelectionTimeoutError: localhost:54224: [WinError 10061] No connection could be made because the target machine active
ly refused it, Timeout: 3.0s, Topology Description: <TopologyDescription id: 61f848e5251fb5a778c86a17, topology_type: Single, servers: [<ServerDescription
('localhost', 54224) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:54224: [WinError 10061] No connection could be made because the target
machine actively refused it')>]>
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pymongo\topology.py:218: ServerSelectionTimeoutError
------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------
{"t":{"$date":"2022-01-31T20:39:01.817Z"},"s":"F", "c":"CONTROL", "id":20574, "ctx":"main","msg":"Error during global initialization","attr":{"error":{
"code":38,"codeName":"FileNotOpen","errmsg":"Failed to open C:/dev/null"}}}
==================================================================== warnings summary ====================================================================
..\..\..\..\..\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_asyncio\plugin.py:191
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_asyncio\plugin.py:191: DeprecationWarning: The '
asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration f
ile.
config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)
tests/test_get_users.py::test_using_motor_client
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_motor\plugin.py:21: DeprecationWarning: There is
no current event loop
loop = asyncio.get_event_loop()
tests/test_get_users.py::test_using_motor_client
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_asyncio\plugin.py:317: DeprecationWarning: '@pyt
est.fixture' is applied to <fixture root_directory, file=C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\
pytest_motor\plugin.py, line=29> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use
'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
warnings.warn(
tests/test_get_users.py::test_using_motor_client
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_asyncio\plugin.py:317: DeprecationWarning: '@pyt
est.fixture' is applied to <fixture mongod_binary, file=C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\p
ytest_motor\plugin.py, line=35> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use
'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
warnings.warn(
tests/test_get_users.py::test_using_motor_client
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_asyncio\plugin.py:317: DeprecationWarning: '@pyt
est.fixture' is applied to <fixture _database_path, file=C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\
pytest_motor\plugin.py, line=56> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use
'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
warnings.warn(
tests/test_get_users.py::test_using_motor_client
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_asyncio\plugin.py:317: DeprecationWarning: '@pyt
est.fixture' is applied to <fixture mongod_socket, file=C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\p
ytest_motor\plugin.py, line=66> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use
'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
warnings.warn(
tests/test_get_users.py::test_using_motor_client
C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\pytest_asyncio\plugin.py:317: DeprecationWarning: '@pyt
est.fixture' is applied to <fixture motor_client, file=C:\Users\admin\AppData\Local\pypoetry\Cache\virtualenvs\testing-gezlx-qt-py3.10\lib\site-packages\py
test_motor\plugin.py, line=92> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use '
auto' mode to seamlessly handle all these fixtures as asyncio-driven).
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================================ short test summary info =================================================================
FAILED tests/test_get_users.py::test_using_motor_client - pymongo.errors.ServerSelectionTimeoutError: localhost:54224: [WinError 10061] No connection co...
============================================================= 1 failed, 7 warnings in 4.11s ==============================================================
The library just... doesn't work :/
I tried to use it with just the provided example and... it raises error
OS: Windows 10
Here are error details: