Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: make Error constructor more robust to broken objects #42850

Merged
merged 2 commits into from
Oct 30, 2021

Conversation

vtjnash
Copy link
Sponsor Member

@vtjnash vtjnash commented Oct 29, 2021

We sometimes make incompletely defined objects for testing, such as declaring simply struct AnInt <: Signed; end, but not defining the methods required by their API. If we have an error involving them, that then sometimes breaks the error reporting code, obscuring the real point of failure. This tries to be more robust against that case, so we still get information on what expression caused the failure to occur and it doesn't kill the rest of the testset.

@vtjnash vtjnash added the testsystem The unit testing framework and Test stdlib label Oct 29, 2021
else
bt_str = ""
end
value = try # try the latest world for this, since we might have eval'd new code for show
Copy link
Member

Choose a reason for hiding this comment

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

Would we not need to do this above as well?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

That probably does make sense too. I wasn't sure at first which one was getting called in that case

stdlib/Test/src/Test.jl Outdated Show resolved Hide resolved
Copy link
Member

@simeonschaub simeonschaub left a comment

Choose a reason for hiding this comment

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

Seems like a useful improvement to me!

@vtjnash vtjnash added the status:merge me PR is reviewed. Merge when all tests are passing label Oct 29, 2021
@aviatesk aviatesk merged commit ee1926f into master Oct 30, 2021
@aviatesk aviatesk deleted the jn/Test-Error-sprint-safe branch October 30, 2021 05:02
@DilumAluthge DilumAluthge removed the status:merge me PR is reviewed. Merge when all tests are passing label Oct 30, 2021
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants