PYTHON-4737 Migrate test_binary.py to async#1863
Conversation
test/asynchronous/test_client.py
Outdated
|
|
||
| @async_client_context.require_connection | ||
| async def test_legacy_java_uuid_roundtrip(self): | ||
| from_java = ( |
There was a problem hiding this comment.
Any way we can share this blob with test_binary? Same for from_csharp.
There was a problem hiding this comment.
yeah, good call!
test/asynchronous/test_client.py
Outdated
| import pytest | ||
| import pytest_asyncio | ||
|
|
||
| from bson.binary import * |
There was a problem hiding this comment.
We try to avoid * imports for a few reasons: https://stackoverflow.com/questions/2386714/why-is-import-bad
test/asynchronous/test_client.py
Outdated
| unittest, | ||
| ) | ||
| from test.asynchronous.pymongo_mocks import AsyncMockClient | ||
| from test.test_binary import TestBinary |
There was a problem hiding this comment.
Importing TestBinary directly will actually cause pytest/unittest to pick up and run TestBinary in this file too. Instead we need to mangle to name, like: from test.test_binary import TestBinary as BinaryBase or move the test data out of TestBinary into to a global var that we can import.
test/asynchronous/test_client.py
Outdated
| async def test_dict_hints_create_index(self): | ||
| await self.db.t.create_index({"x": pymongo.ASCENDING}) | ||
|
|
||
| @async_client_context.require_connection |
There was a problem hiding this comment.
I beleive we can remove the require_connections now that this is in test_client.
|
My brain forgot to check up on this until now haha, but thanks for the feedback! I think I made the appropriate changes :) |
|
Ah good catch! I'll try something else! |
…ary tests from running on import in test client

More like test_binary shouldn't have any client stuff in it....I've moved tests that require the client from
test_binary.pytotest_client.py