-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-46425: fix direct invocation of asyncio
tests
#30725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason that you run tests like scripts?
I just click "Run file" in my IDE, it is the easiest thing to do when testing something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Historically unittest.main()
was added on demand during unit tests debugging.
Thanks for spreading it everywhere.
@asvetlov: Please replace |
(cherry picked from commit 5a53400) Co-authored-by: Nikita Sobolev <[email protected]>
GH-30782 is a backport of this pull request to the 3.10 branch. |
(cherry picked from commit 5a53400) Co-authored-by: Nikita Sobolev <[email protected]>
GH-30783 is a backport of this pull request to the 3.9 branch. |
(cherry picked from commit 5a53400) Co-authored-by: Nikita Sobolev <[email protected]>
(cherry picked from commit 5a53400) Co-authored-by: Nikita Sobolev <[email protected]> Co-authored-by: Nikita Sobolev <[email protected]>
(cherry picked from commit 5a53400) Co-authored-by: Nikita Sobolev <[email protected]>
Right now some tests in
test_asyncio
are suitable to be executed directly aspython Lib/test/test_asyncio/test_X.py
and some are only executable with-m test
or-m Lib/test/test_asyncio
.cpython/Lib/test/test_asyncio/test_asyncio_waitfor.py
Lines 60 to 61 in c02e860
cpython/Lib/test/test_asyncio/test_context.py
Lines 33 to 34 in c02e860
This does not look good to me.
So, I've fixed several tests modules in
test_asyncio
when invoked directly aspython module_name.py
There were two major problems:
unittest.main()
callThe best way to illustrate this problem is to show
Lib/test/test_asyncio/test_runners.py
:Step 1. No changes.
Step 2. Fixed relative import.
(nothing happens)
Step 3. With
unottest.main()
:CC @corona10 as my mentor.
https://bugs.python.org/issue46425