Skip to content

Re-raise unexpected exceptions instead of swallowing them in tests#152019

Open
aisk wants to merge 2 commits into
python:mainfrom
aisk:fix-test-swallowed-exceptions
Open

Re-raise unexpected exceptions instead of swallowing them in tests#152019
aisk wants to merge 2 commits into
python:mainfrom
aisk:fix-test-swallowed-exceptions

Conversation

@aisk

@aisk aisk commented Jun 23, 2026

Copy link
Copy Markdown
Member

When fixing #137420, I found that some existing test code swallows exceptions it doesn't care about.

I think these are simple, test only fixes, so the issue and the news entry aren't required.

@aisk aisk requested a review from barneygale as a code owner June 23, 2026 16:04
@bedevere-app bedevere-app Bot added tests Tests in the Lib/test dir awaiting review labels Jun 23, 2026
@StanFromIreland

StanFromIreland commented Jun 23, 2026

Copy link
Copy Markdown
Member

Nice catch! I asked Claude to search for more of these, and it came back with one more:

The one genuine new bug: Lib/test/test_launcher.py:469 (test_search_major_2)

  except subprocess.CalledProcessError:
      if not is_installed("2.7"):
          raise unittest.SkipTest("requires at least one Python 2.x install")
      # ← missing `raise`
  self.assertEqual("PythonCore", data["env.company"])   # data never got assigned

From a glance, it seems correct (although we're unlikely to hit it on most systems), but I think we can include it here.

Co-authored-by: Stan Ulbrych <stan@python.org>
@aisk

aisk commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

@StanFromIreland Thank you for the review, updated!

@StanFromIreland StanFromIreland added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 23, 2026
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @StanFromIreland for commit 2c2f096 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F152019%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 23, 2026
@StanFromIreland

Copy link
Copy Markdown
Member

Looks good, but let's run the Buildbots, just to be safe, since these are all quite platform specific cases.

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.

3 participants