Skip to content

Allow running tests directly#2279

Merged
CharliePoole merged 1 commit intomasterfrom
issue-2242
Jun 26, 2017
Merged

Allow running tests directly#2279
CharliePoole merged 1 commit intomasterfrom
issue-2242

Conversation

@CharliePoole
Copy link
Copy Markdown
Member

Fixes #2242

This PR goes back to the pre-3.7 approach of creating a new TestExecutionContext when the current context is null. However, it uses a special adhoc context, that sets up non-null values in several members to avoid null reference exceptions.

This is not intended as a general fix to allow running tests directly. The executing program has no way to find out about warnings or multiple assertion failures and there is no intention to support those new features. This merely keeps things that worked before working for the user.

@CharliePoole
Copy link
Copy Markdown
Member Author

Unrelated timing error in travis-ci/pr run. Restarted.

Copy link
Copy Markdown
Contributor

@jnm2 jnm2 left a comment

Choose a reason for hiding this comment

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

Seems to be a good approach. It's one we can easily tweak as things come up.

@CharliePoole CharliePoole merged commit b371802 into master Jun 26, 2017
@CharliePoole CharliePoole deleted the issue-2242 branch June 26, 2017 17:50
JoostK added a commit to JoostK/nunit that referenced this pull request Feb 6, 2026
…lable

The implicit availability of `AdhocContext` since nunit#2279 has made the fallback
branches dead code, causing the text to be written into the ad-hoc test result
which is never written anywhere. This commit restores the original intent of
`TextCapture` by detecting this situation and redirecting the write into the
default writer.

Fixes nunit#5120
JoostK added a commit to JoostK/nunit that referenced this pull request Feb 6, 2026
…lable

The implicit availability of `AdhocContext` since nunit#2279 has made the fallback
branches dead code, causing the text to be written into the ad-hoc test result
which is never written anywhere. This commit restores the original intent of
`TextCapture` by detecting this situation and redirecting the write into the
default writer.

Fixes nunit#5120
stevenaw pushed a commit that referenced this pull request Feb 16, 2026
…lable

The implicit availability of `AdhocContext` since #2279 has made the fallback
branches dead code, causing the text to be written into the ad-hoc test result
which is never written anywhere. This commit restores the original intent of
`TextCapture` by detecting this situation and redirecting the write into the
default writer.

Fixes #5120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running tests directly should never surface a NullReferenceException

2 participants