Skip to content

Conversation

@SubbaraoGarlapati
Copy link
Contributor

asyncio.staggered in Lib/test/test_asyncio/test_eager_task_factory.py and test.support.import_helper in Lib/test/test_monitoring.py are both modules that are used without being properly imported in the file (relying on other imports to actually import them). They should be explicitly imported for the sake of correctness and safety (in case they stop being imported in other imports).

@kumaraditya303
Copy link
Contributor

They should be explicitly imported for the sake of correctness and safety (in case they stop being imported in other imports).

The existing code is correct and if in future implicit behavior changes, the tests would fail anyways so can be fixed later on.

@Yhg1s
Copy link
Member

Yhg1s commented Nov 19, 2025

I think this is right for asyncio (since python -c "import asyncio; asyncio.gather" is not an error), but not for test.support:

% python -c "import test.support; test.support.import_helper"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import test.support; test.support.import_helper
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'test.support' has no attribute 'import_helper'

Relying on asyncio to import asyncio.gather (like it does now) is one thing, but relying on something else to import test.support.import_helper leaves us in a fragile state where the ordering of tests or unrelated changes to other files can cause failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants