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
Add flag to print all attachments for successful tests #242
Conversation
@aspiers give this a try and let me know if it's what you're looking for. |
2682de6
to
057866c
Compare
@masayukig Do you have any thoughts on this? |
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.
I didn't see this patch deeply (I'll do it later) but, can we have unit tests for this change? Meaningless?
Unit testing this is a bit tricky, since the difference when the flag is set is to print text attachments that are not stdout and stderr. The only way I could think of testing it would be to create a fake test case with a text attachment, run it with the flag, and then inspect the captured output from the run. Which seemed like a lot of effort for minimal gain. |
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.
LGTM. This option works in my environment, too. But I'd like to wait for a while for @aspiers 's comment and/or feedback before merging.
@mtreinish Sorry for the delay. I've now tested this via
and it works great! Many thanks :-) |
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.
Just an observation (even though I hardly know this codebase, so treat with a big pinch of salt) - there seems to be a lot of parameter passing required, which makes adding new options like this a pretty heavyweight change for what it is. Maybe worth a refactor so that an "output options" object is passed around instead?
successful tests you can use the ``--all-attachments`` flag to print all text | ||
attachments on both successful and failed tests. If both ``--all-attachments`` | ||
and ``--suppress-attachments`` are set then the ``--suppress--attachments`` | ||
flag will take priority and no attachments will be printed for successful |
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.
Wouldn't it make more sense to error in this case?
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.
I was just being lazy, doing it this way was slightly easier to implement. In my mind it doesn't matter exactly what the behavior is as long as we're explicit about how it works. That being said, this just made me realize there is a broken edge case with mixed inputs right now. If you set suppress-attachments
in the user config file and --all-attachments
on the cli that will mean no attachments print. So I'll have to change the behavior here anyway to make sure the cli takes precedence for both. I'll change this to an error at the same time since I'm not attached to any behavior.
That might be something to investigate in the future. Part of my concern with doing this though is that each most of the places we pass a parameter is an external public interface. So we have to watch out for any backwards compatibility issues. For example, all the the arg parsing just uses the public python interface so it passes all the parsed args just to that. It'll be easier to do a cleanup like this in the lower internal levels (like the |
This commit adds a new flag, --all-attachments, to the run, load, and last commands (in addition to a matching user config flag). When set this flag will tell subunit trace to print all text attachments for a test whether it was successful or it failed. Fixes #223
057866c
to
78ca23c
Compare
https://ci.appveyor.com/project/mtreinish/stestr/builds/25586943/job/1a0fw6pgbgtuivh6#L196
This is really annoying... I pushed a patch for this #246 . |
This commit adds a new flag, --all-attachments, to the run, load, and
last commands (in addition to a matching user config flag). When set
this flag will tell subunit trace to print all text attachments for a
test whether it was successful or it failed.
Fixes #223