GeezerVison is showing github.com — gh-123780: Make test_pkgutil clean up `spam` module by mhsmith · Pull Request #123036 · python/cpython
Conversation
mhsmith
commented
Aug 15, 2024
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
When running the tests with --randomize, as is done by the buildbots, I came across this failure:
======================================================================
ERROR: test_find_class (test.test_pickle.CUnpicklerTests.test_find_class)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/msmith/git/python/cpython/Lib/test/pickletester.py", line 1265, in test_find_class
self.assertRaises(ModuleNotFoundError, unpickler.find_class, 'spam', 'log')
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/msmith/git/python/cpython/Lib/unittest/case.py", line 804, in assertRaises
return context.handle('assertRaises', args, kwargs)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/msmith/git/python/cpython/Lib/unittest/case.py", line 238, in handle
callable_obj(*args, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
AttributeError: module 'spam' has no attribute 'log'
======================================================================
ERROR: test_find_class (test.test_pickle.PyUnpicklerTests.test_find_class)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/msmith/git/python/cpython/Lib/test/pickletester.py", line 1265, in test_find_class
self.assertRaises(ModuleNotFoundError, unpickler.find_class, 'spam', 'log')
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/msmith/git/python/cpython/Lib/unittest/case.py", line 804, in assertRaises
return context.handle('assertRaises', args, kwargs)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/msmith/git/python/cpython/Lib/unittest/case.py", line 238, in handle
callable_obj(*args, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/Users/msmith/git/python/cpython/Lib/pickle.py", line 1620, in find_class
return getattr(sys.modules[module], name)
AttributeError: module 'spam' has no attribute 'log'
----------------------------------------------------------------------
Ran 857 tests in 2.954s
FAILED (errors=2, skipped=31)
test test_pickle failed
This can be reproduced by running only test_pkgutil and test_pickle, in that order. test_pkgutil leaves behind a spam module in sys.modules, while test_pickle assumes there is no such module.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
PRs that need backporting should not skip issue; the issue number helps keep related PRs grouped together.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
encukou
changed the title
Make test_pkgutil clean up spam module
gh-123780: Make test_pkgutil clean up spam module
Sep 6, 2024
|
Thanks @mhsmith for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
PRs that need backporting should not skip issue; the issue number helps keep related PRs grouped together.
OK, I'll remember that. But doesn't the original PR provide enough grouping already? It links to the backports, and the backports link to it.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Well, not as clearly as the issue's Linked PRs section :)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
encukou
encukou approved these changes
ericsnowcurrently
Awaiting requested review from ericsnowcurrently
ericsnowcurrently is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|