-
Notifications
You must be signed in to change notification settings - Fork 7
Add verbosity to comparison checker #52
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
Conversation
3eb1b4e to
ee26e3c
Compare
ee26e3c to
4514bf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds verbosity support to the ComparisonTester class to improve debugging capabilities when tests fail. The verbosity parameter allows users to control debug output level and can be wired directly to pytest's verbosity settings.
- Adds a
verbosityparameter to theComparisonTesterconstructor - Implements verbose output showing both expected and actual lines during comparison
- Modifies failure behavior to continue processing in verbose mode for better debugging
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
shuchitak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good change. I tested this with a sim test in lib_xua and it works as expected.
I'm unsure which is more useful - print the golden and actual outputs separately allowing the user to diff them in a separate editor if they wish - or interleaving them to show exactly what's missing .
However this is definitely a step in the right direction and way better than what we currently have!
Thank you for the feedback :) |
|
Tested this on a failing lib_xud test and the verbose output is quite helpful, as opposed to the 'ERROR: Length of expected output less than output' that I would otherwise get! GOLDEN: Packet: HOST -> DEVICE |
That is a help, but wouldn't you get the same result if instead of You use? Then it woudn'y matter about verbosity level. |
We allow regex based comparison and also unordered (ignore ordering) comparisons so assert capture == expected wouldn't work. |
In order to attempt to make
ComparisonTestera bit more friendly when debugging - and avoid copying the printing code everywhere (like this https://github.com/xmos/lib_gpio/blob/develop/tests/helpers.py) - I have added averbosityparam to the constructor.This is an
int(rather thanbool) - so we can directly wire it up to verbosity ofpytest(so we dont have to change test code to get more debug info out) e.g.usage:
then
pyteststill gives stuff likeand
pytest -vgives more verbose output likeIts only a relatively small change here: #52
I'm sure we can pretty the output a bit, but be nice to have it used from one place - if it meets peoples requirements?
If people could check it/review it that would be super - put "everyone" on review as its quite a common area of complaint and just to let people make people aware of it really