-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-131031: Fix separated running of pickle tests
#133218
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
pickle testspickle tests
|
cc @tomasr8 (sorry for choosing you but current pickle expert is inactive) |
|
Are you sure the assertions are being executed? Since |
|
This looks ok, but I'm not expert in his area :/ @serhiy-storchaka could you have a look? |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
serhiy-storchaka
left a comment
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.
Good PR, but using a global class which is not imported in test_pickle.py instead of AbstractPickleTests would fix the tests too. See #133356.
Faking the __main__ module looks heavyweight, we don't know what side effects can it have. We would use this approach if there was no other way.
| real_main = sys.modules.get("__main__") | ||
| fake_main = types.ModuleType("__main__") | ||
|
|
||
| sys.modules["__main__"] = fake_main |
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.
You can use support.swap_item(). It is already used in other tests to fake a module.
I found that tests stopped running successfully directly after this commit (PR #122373)
test_pickletests failing when invoked directly #131031