Fixed #35448 -- Created a custom StreamHandler
for DebugSQLTextTestResult
#18255
+45
−6
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.
Trac ticket number
ticket-35448
Branch description
Test using
--debug-sql
were formatting the whole logstream instead on only the SQL code within it.As discussed in the ticket:
LogRecord
level but is lost after formattingThis introduces a specific handler that keeps track of all record to reformat only the SQL code when requested by the
--debug-sql
flag.This has the downfall of requiring to keep the records in memory alongside of their output until the end of the test suite instead of only keeping the formatted output.
When the formatted SQL display is required, the handler will reformat run a new formatting round to make the output multi-line (eg: 1 line per attribute + formatted SQL code) to keep the display as close at it was previously.
One issue I did not manage to solve is when the test returns an error instead of a failure, in this case the
LogHandler
is not created and we don't have the details on the SQL code. When this happens, the previous behavior is maintained.New output
Old output
Checklist
main
branch.