-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-102251: add missing cleanups for test_import
#104796
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
Closed
Closed
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
db000e8
add some cleanups
sunmy2019 e6bc99c
remove the sys.argv trick
sunmy2019 ea8e894
Merge branch 'main' into gh-102251
sunmy2019 5dbb8c3
Merge branch 'main' of github.com:python/cpython into gh-102251
sunmy2019 c6b42ee
follow @erlend-aasland's advice
sunmy2019 2ee60e2
revert this as this would be intended at gh-104796
sunmy2019 20307d0
Merge branch 'main' of github.com:python/cpython into gh-102251
sunmy2019 75230b0
Merge branch 'main' of github.com:python/cpython into gh-102251
sunmy2019 695fd16
rebase after changes to #105085
sunmy2019 0480053
Merge branch 'main' of github.com:python/cpython into gh-102251
sunmy2019 5934e50
collect tests in a single class
sunmy2019 60b4921
Update Lib/test/test_import/__init__.py
sunmy2019 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1980,10 +1980,6 @@ class SinglephaseInitTests(unittest.TestCase): | |
|
||
@classmethod | ||
def setUpClass(cls): | ||
if '-R' in sys.argv or '--huntrleaks' in sys.argv: | ||
# https://github.com/python/cpython/issues/102251 | ||
raise unittest.SkipTest('unresolved refleaks (see gh-102251)') | ||
Comment on lines
-1992
to
-1994
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 trick cannot be used with |
||
|
||
spec = importlib.util.find_spec(cls.NAME) | ||
from importlib.machinery import ExtensionFileLoader | ||
cls.FILE = spec.origin | ||
|
@@ -2330,6 +2326,8 @@ def test_variants(self): | |
self.assertIs(basic.look_up_self(), basic_lookedup) | ||
self.assertEqual(basic.initialized_count(), expected_init_count) | ||
|
||
loaded.module._clear_module_state() | ||
|
||
def test_basic_reloaded(self): | ||
# m_copy is copied into the existing module object. | ||
# Global state is not changed. | ||
|
@@ -2413,6 +2411,11 @@ def test_with_reinit_reloaded(self): | |
|
||
self.assertIs(reloaded.snapshot.cached, reloaded.module) | ||
|
||
if hasattr(loaded.module, '_clear_module_state'): | ||
loaded.module._clear_module_state() | ||
if hasattr(reloaded.module, '_clear_module_state'): | ||
reloaded.module._clear_module_state() | ||
|
||
# Currently, for every single-phrase init module loaded | ||
# in multiple interpreters, those interpreters share a | ||
# PyModuleDef for that object, which can be a problem. | ||
|
@@ -2488,7 +2491,7 @@ def test_basic_multiple_interpreters_main_no_reset(self): | |
# * module's global state was updated, not reset | ||
|
||
@requires_subinterpreters | ||
def test_basic_multiple_interpreters_deleted_no_reset(self): | ||
def test_basic_multiple_interpreters_deleted_no_reset_skip_ref_leak_test(self): | ||
# without resetting; already loaded in a deleted interpreter | ||
|
||
# At this point: | ||
|
sunmy2019 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.