Skip to content

Fix some tests failing when run with --verbose/--quiet. - #1996

Merged
grynspan merged 1 commit into
mainfrom
jgrynspan/verbose-fails-tests
Oct 30, 2026
Merged

grynspan merged 1 commit into
mainfrom
jgrynspan/verbose-fails-tests

Conversation

@grynspan

Copy link
Copy Markdown
Contributor

Some of our tests are sensitive to the verbosity level set at call time because they test the textual output to the console or to the JSON stream. These tests create Configuration values with default verbosity, but Runner has logic to pop the configuration before it calls event handlers, which causes us to go back to the configuration created at process start. If that configuration has non-default verbosity, the resulting strings will be generated incorrectly.

This PR adjusts the logic of those tests to tell Runner not to pop the configuration. This means they can't call #expect() from within their local event handlers, but they're not designed to do so anyway and are instead just collecting strings for later analysis.

This change does not affect test code outside Swift Testing itself.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

Some of our tests are sensitive to the verbosity level set at call time because
they test the textual output to the console or to the JSON stream. These tests
create `Configuration` values with default verbosity, but `Runner` has logic to
pop the configuration before it calls event handlers, which causes us to go back
to the configuration created at process start. If that configuration has
non-default verbosity, the resulting strings will be generated incorrectly.

This PR adjusts the logic of those tests to tell `Runner` _not_ to pop the
configuration. This means they can't call `#expect()` from within their local
event handlers, but they're not designed to do so anyway and are instead just
collecting strings for later analysis.
@grynspan grynspan added this to the Swift 6.5.0 (main) milestone Oct 30, 2026
@grynspan grynspan self-assigned this Oct 30, 2026
@grynspan grynspan added the bug 🪲 Something isn't working label Oct 30, 2026
@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@harlanhaskins harlanhaskins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems okay and isolated enough

@grynspan
grynspan merged commit 678d564 into main Oct 30, 2026
34 of 39 checks passed
@grynspan
grynspan deleted the jgrynspan/verbose-fails-tests branch October 30, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants