-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
For the most part, Motor relies on the calls to the underlying PyMongo functions to raise DeprecationWarnings. Since these synchronous calls are run using a thread pool executor, the application must be run using -Wdefault in order to make the warning user-visible. For example:
$ # test script $ cat sample.py import asyncio from motor.motor_asyncio import AsyncIOMotorClient async def main(): client = AsyncIOMotorClient() print(await client.admin.command('ping')) print(client.nodes) await client.fsync() asyncio.run(main()) $ $ # running without -W $ python sample.py {'ok': 1.0} frozenset({('localhost', 27017)}) $ $ # running it with -W $ python -Wdefault sample.py {'ok': 1.0} frozenset({('localhost', 27017)}) /Users/pmital/.pyenv/versions/3.7.5/lib/python3.7/concurrent/futures/thread.py:57: DeprecationWarning: fsync is deprecated. Use client.admin.command('fsync') instead. result = self.fn(*self.args, **self.kwargs)
We should come up with a better way to raise these warnings so that applications don't need to change their invocation to see them.
- is related to
-
MOTOR-1222 Motor uses deprecated GridFS apis
- Closed
- related to
-
MOTOR-697 Add ability to deprecate wrapped commands via AsyncCommand
- Closed