Skip to content

Conversation

sleepyStick
Copy link
Contributor

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

@sleepyStick sleepyStick marked this pull request as ready for review September 17, 2024 23:03

@async_client_context.require_connection
async def test_legacy_java_uuid_roundtrip(self):
from_java = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way we can share this blob with test_binary? Same for from_csharp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good call!

import pytest
import pytest_asyncio

from bson.binary import *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid * imports for a few reasons: https://stackoverflow.com/questions/2386714/why-is-import-bad

unittest,
)
from test.asynchronous.pymongo_mocks import AsyncMockClient
from test.test_binary import TestBinary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

async def test_dict_hints_create_index(self):
await self.db.t.create_index({"x": pymongo.ASCENDING})

@async_client_context.require_connection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I beleive we can remove the require_connections now that this is in test_client.

@sleepyStick
Copy link
Contributor Author

My brain forgot to check up on this until now haha, but thanks for the feedback! I think I made the appropriate changes :)

Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-09-24 at 12 13 11 PM Hmm, my TestBinary as BinaryBase idea doesn't work. We'll have to do something else.

@sleepyStick
Copy link
Contributor Author

Ah good catch! I'll try something else!

Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sleepyStick sleepyStick merged commit 1e395de into mongodb:master Sep 30, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants