Skip to content

Conversation

sleepyStick
Copy link
Contributor

@sleepyStick sleepyStick commented Oct 1, 2024

Note: I tried to add async_ensure_all_connected to /test/asynchronous/helpers.py but was running into some issues (circular imports I think?) so that's why I decided to just keep it in test/utils.py but happy to look into it again, if needed.

@sleepyStick sleepyStick marked this pull request as ready for review October 2, 2024 16:27
@sleepyStick sleepyStick requested a review from NoahStapp October 2, 2024 16:27
@NoahStapp
Copy link
Contributor

Note: I tried to add async_ensure_all_connected to /test/asynchronous/helpers.py but was running into some issues (circular imports I think?) so that's why I decided to just keep it in test/utils.py but happy to look into it again, if needed.

What's the specific error you were getting?

@sleepyStick
Copy link
Contributor Author

sleepyStick commented Oct 3, 2024

Note: I tried to add async_ensure_all_connected to /test/asynchronous/helpers.py but was running into some issues (circular imports I think?) so that's why I decided to just keep it in test/utils.py but happy to look into it again, if needed.

What's the specific error you were getting?

test/__init__.py:31: in <module>
    from test.helpers import (
test/helpers.py:40: in <module>
    from test.utils import wait_until
test/utils.py:33: in <module>
    from test import client_context, db_pwd, db_user
E   ImportError: cannot import name 'client_context' from partially initialized module 'test' (most likely due to a circular import) (/Users/iris.ho/GitHub/mongo-python-driver/test/__init__.py)```



edit: okay it is a circular import
`test/__init__` tries to import from `helpers`, `helpers` tries to import `wait_until` or `async_wait_until` from `utils`. and utils wants to load something from `test`

And this occurs when i try to move the func into `helpers` because `ensure_all_connected`/`async_ensure_all_connected`, uses `wait_until`/`async_wait_until`..

@NoahStapp
Copy link
Contributor

Note: I tried to add async_ensure_all_connected to /test/asynchronous/helpers.py but was running into some issues (circular imports I think?) so that's why I decided to just keep it in test/utils.py but happy to look into it again, if needed.

What's the specific error you were getting?

test/__init__.py:31: in <module>
    from test.helpers import (
test/helpers.py:40: in <module>
    from test.utils import wait_until
test/utils.py:33: in <module>
    from test import client_context, db_pwd, db_user
E   ImportError: cannot import name 'client_context' from partially initialized module 'test' (most likely due to a circular import) (/Users/iris.ho/GitHub/mongo-python-driver/test/__init__.py)```



edit: okay it is a circular import
`test/__init__` tries to import from `helpers`, `helpers` tries to import `wait_until` or `async_wait_until` from `utils`. and utils wants to load something from `test`

And this occurs when i try to move the func into `helpers` because `ensure_all_connected`/`async_ensure_all_connected`, uses `wait_until`/`async_wait_until`..

Got it, leaving it in utils is fine for now.

@sleepyStick sleepyStick merged commit af23139 into mongodb:master Oct 3, 2024
35 checks passed
@sleepyStick sleepyStick deleted the PYTHON-4805 branch October 3, 2024 17:27
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