Skip to content

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

Merged
StanFromIreland merged 2 commits into
python:mainfrom
aisk:fix-test-swallowed-exceptions
Jun 24, 2026
Merged

Re-raise unexpected exceptions instead of swallowing them in tests#152019
StanFromIreland merged 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.

@StanFromIreland StanFromIreland self-assigned this Jun 24, 2026
@StanFromIreland StanFromIreland added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 24, 2026
@StanFromIreland StanFromIreland merged commit 6c3da17 into python:main Jun 24, 2026
151 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @aisk for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 24, 2026

Copy link
Copy Markdown

GH-152102 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 24, 2026
@bedevere-app

bedevere-app Bot commented Jun 24, 2026

Copy link
Copy Markdown

GH-152103 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 24, 2026
@bedevere-app

bedevere-app Bot commented Jun 24, 2026

Copy link
Copy Markdown

GH-152104 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 24, 2026
@StanFromIreland

Copy link
Copy Markdown
Member

Merged, thanks @aisk.

StanFromIreland added a commit that referenced this pull request Jun 24, 2026
…arious tests (GH-152019) (#152104)

(cherry picked from commit 6c3da17)

Co-authored-by: An Long <aisk@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
StanFromIreland added a commit that referenced this pull request Jun 24, 2026
…arious tests (GH-152019) (#152102)

(cherry picked from commit 6c3da17)

Co-authored-by: An Long <aisk@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
StanFromIreland added a commit that referenced this pull request Jun 24, 2026
…arious tests (GH-152019) (#152103)

(cherry picked from commit 6c3da17)

Co-authored-by: An Long <aisk@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip issue skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants