Title: `test_pkgutil` should clean up `spam` module · Issue #123780 · python/cpython · GitHub
Open Graph Title: `test_pkgutil` should clean up `spam` module · Issue #123780 · python/cpython
X Title: `test_pkgutil` should clean up `spam` module · Issue #123780 · python/cpython
Description: When running the tests with --randomize, as is done by the buildbots, @mhsmith came across this failure: ====================================================================== ERROR: test_find_class (test.test_pickle.CUnpicklerTests.test...
Open Graph Description: When running the tests with --randomize, as is done by the buildbots, @mhsmith came across this failure: ====================================================================== ERROR: test_find_clas...
X Description: When running the tests with --randomize, as is done by the buildbots, @mhsmith came across this failure: ====================================================================== ERROR: test_find_clas...
Opengraph URL: https://github.com/python/cpython/issues/123780
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`test_pkgutil` should clean up `spam` module","articleBody":"When running the tests with --randomize, as is done by the buildbots, @mhsmith came across this failure:\r\n\r\n```\r\n======================================================================\r\nERROR: test_find_class (test.test_pickle.CUnpicklerTests.test_find_class)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n File \"/Users/msmith/git/python/cpython/Lib/test/pickletester.py\", line 1265, in test_find_class\r\n self.assertRaises(ModuleNotFoundError, unpickler.find_class, 'spam', 'log')\r\n ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/unittest/case.py\", line 804, in assertRaises\r\n return context.handle('assertRaises', args, kwargs)\r\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/unittest/case.py\", line 238, in handle\r\n callable_obj(*args, **kwargs)\r\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\r\nAttributeError: module 'spam' has no attribute 'log'\r\n\r\n======================================================================\r\nERROR: test_find_class (test.test_pickle.PyUnpicklerTests.test_find_class)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n File \"/Users/msmith/git/python/cpython/Lib/test/pickletester.py\", line 1265, in test_find_class\r\n self.assertRaises(ModuleNotFoundError, unpickler.find_class, 'spam', 'log')\r\n ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/unittest/case.py\", line 804, in assertRaises\r\n return context.handle('assertRaises', args, kwargs)\r\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/unittest/case.py\", line 238, in handle\r\n callable_obj(*args, **kwargs)\r\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\r\n File \"/Users/msmith/git/python/cpython/Lib/pickle.py\", line 1620, in find_class\r\n return getattr(sys.modules[module], name)\r\nAttributeError: module 'spam' has no attribute 'log'\r\n\r\n----------------------------------------------------------------------\r\nRan 857 tests in 2.954s\r\n\r\nFAILED (errors=2, skipped=31)\r\ntest test_pickle failed\r\n```\r\n\r\nThis 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.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-123036\n* gh-123781\n* gh-123782\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/encukou","@type":"Person","name":"encukou"},"datePublished":"2024-09-06T13:22:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/123780/cpython/issues/123780"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ba5d9d59-f845-302b-7368-5209fbd8474a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD5E:34D83D:28BAA9:360760:696B382D |
| html-safe-nonce | 61f03c256d43708d90f81f4fea3d39fc09fb117ec81d012a45b4279dbda6107b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDVFOjM0RDgzRDoyOEJBQTk6MzYwNzYwOjY5NkIzODJEIiwidmlzaXRvcl9pZCI6IjgxODg1MDk5MjkzMjkwODAzNjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9188b7bc053c05a8abefcc76c5f526c8dac63ba546cd5493f43e93d3d88e256d |
| hovercard-subject-tag | issue:2510428654 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/123780/issue_layout |
| twitter:image | https://opengraph.githubassets.com/32bc5e7e2504340349073cce1596dc5cdbc0591bf18addb880773d71af1ecb29/python/cpython/issues/123780 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/32bc5e7e2504340349073cce1596dc5cdbc0591bf18addb880773d71af1ecb29/python/cpython/issues/123780 |
| og:image:alt | When running the tests with --randomize, as is done by the buildbots, @mhsmith came across this failure: ====================================================================== ERROR: test_find_clas... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | encukou |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width