8000 gh-107446: Fix test_inspect.test_class_with_method_from_other_module under --forever by gaogaotiantian · Pull Request #107451 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107446: Fix test_inspect.test_class_with_method_from_other_module under --forever #107451

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

Merged
merged 5 commits into from
Aug 3, 2023

Conversation

gaogaotiantian
Copy link
Member
@gaogaotiantian gaogaotiantian commented Jul 29, 2023

The test creates a temporary directory to store the modules every time it executes. However, with --forever, the test will run more than once. When the old directory got removed, the cached module would lost source. In order to fix this, we can simply remove the module from sys.modules and force the module to be reloaded every time.

Copy link
Member
@Eclips4 Eclips4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!
Just FYI, I've found it via running refleak tests with 3:3 option. Probably, it's has the same mechanism of running tests as the --forever parameter.

@kumaraditya303 kumaraditya303 enabled auto-merge (squash) August 3, 2023 14:36
8000
@kumaraditya303 kumaraditya303 merged commit 14fbd4e into python:main Aug 3, 2023
@gaogaotiantian gaogaotiantian deleted the fix-test-inspect branch August 3, 2023 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0