-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
gh-118761: Add test_lazy_import for more modules #133057
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
from urllib.request import pathname2url | ||
|
||
from test.support import import_helper | ||
from test.support import cpython_only | ||
from test.support import is_emscripten, is_wasi | ||
from test.support import infinite_recursion | ||
from test.support import os_helper | ||
|
@@ -129,6 +130,10 @@ class StrSubclass(str): | |
for part in p.parts: | ||
self.assertIs(type(part), str) | ||
|
||
@cpython_only | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't fit well in this class, can you add a new test class instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
def test_lazy_import(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind adding the I should have done that on my PRs too but didn't think about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
import_helper.ensure_lazy_imports("pathlib", {"shutil"}) | ||
|
||
def test_str_subclass_common(self): | ||
self._check_str_subclass('') | ||
self._check_str_subclass('.') | ||
|
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.
I think this fits better in
MiscTestCase
(currently at around line 5286). In general I'd put this test close totest__all__
if present; it's sort of similar in testing the behavior of the whole module.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.
Thanks, that's a very helpful comment as I am not familiar with cpython's test suite. Done.