Some tweaks to testing framework. #4594
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Most interesting is an "API change" - the test methods
test.must_exist()
andtest.must_exist_one_of()
now take an optionalmessage
keyword argument which is passed on tofail_test
if the test fails to add to the failure message onstderr
- a couple of test checks already did this, so this is just an extension of an existing technique.The regex used to test exception printing in
TestCommonTests
is now working for Python 3.13, and enabled conditionally - Python's "enhanced error reporting" changed again, in a way that made it easy to reuse the existing regex (if somebody wants to take a shot at unifying them, more power!). This only shows up in the (not-default)runtest.py testing/framework
.Also, one unexpected issue was found - one of the check routines does
output = os.newline.join(output)
, but there is noos.newline
. Could be thatos.linesep
was intended, but just changed it to the Python newline character.Some annotations added, and some cleanup done on possibly unsafe uses - mainly that
self.stderr()
andselt.stdout()
can returnNone
, but several places in the code just did string operations on the return unconditionally. There's already precendent- other places did do a check before using, so just extended the concept to possibly vulnerable palces.Test-framework only changed. Since this isn't user-visible, no additon to RELEASE.
Contributor Checklist:
CHANGES.txt
(and read theREADME.rst
)