-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Display exit code with InvocationErrors #290
Comments
Original comment by @The-Compiler +1 for this feature - I've had tests segfault and no useful info from tox before. I got used to it, but the first time I saw it it took me a while to figure out what happened. |
Original comment by @hpk42 if you can provide a test and put this all into a PR i'll see to merge it. |
Original comment by @blueyed Here is an updated patch that will pass tests at least:
|
Original comment by @blueyed While at it, it might be useful to display it also here:
|
@blueyed - still interested to make this happen? |
@obestwalter |
@blueyed thanks - I might try to crystalize your drops of genius in this issue in a PR then :) |
This is useful, thanks !
|
Hey @ederag thanks! Would you mind open a PR for this yourself? |
Well, that's your patch actually, but if it helps, OK.
|
Hi @ederag you must confuse me with @blueyed :) Great that you want to pick it up! Good questions also, I would have to search around and think about these just as you, but at the moment I need to get the next release out of the way, so I won't go in too deep for now. Just quick of the top of my head:
About the docs: If you find a good place to add that info, you could add it, but I don't see it as necessary, as the user gets more information after a crash and does not necessary need to be told that they would get that information in case of failure.
I don't understand, what you mean by that. My understanding is that this patch is supposed to print also the error code returned by the program when it crashed (e.g. if pytest fails with error 5, we also print that number). If a programm crashes there always will be an error code. It is not possible to have no error code. How about you just get started and open a PR and then we can fix it up together. |
When a program crashes rather than exits (e.g. because of a segfault), it only "kinda' has an exit code: It exits with 128 + number of the signal. That is, at least on Unix, not sure how things look on Windows. It depends on how tox handles this in all places it raises an
That'd make things much clearer. I'm not sure how much effort it'd be though. |
Understood now; "Crashed" was not appropriate, I was referring to pytest-dev/pytest-qt#170 (comment), which was not a segmentation fault, but rather Qt aborting. Thank you both for your inputs, enough to get started. @The-Compiler Agreed, being more verbose is better here. |
As a first step, @blueyed patch has been a little bit completed, hopefully following @The-Compiler recommendations #290 (comment), and tests added. This is in the @blueyed Since you started all this, and wrote the most important part, would you please fork it and create the pull request ? |
@ederag |
Thanks go to Daniel Hahler (@blueyed): Issue tox-dev#290.
@blueyed Thanks, so the commit message was changed to give you credits. Hope there are no mistakes ? |
@ederag |
Thanks go to Daniel Hahler (blueyed): Issue tox-dev#290.
@blueyed |
|
Issue tox-dev#290. Co-authored-by: Daniel Hahler <[email protected]>
* Display exitcode upon InvocationError. Issue #290. Co-authored-by: Daniel Hahler <[email protected]> * hint for exitcode > 128 * add changelog fragment * use keyword argument instead of try/except * add documentation
* Display exitcode upon InvocationError. Issue #290. Co-authored-by: Daniel Hahler <[email protected]> * hint for exitcode > 128 * add changelog fragment * use keyword argument instead of try/except * add documentation * hints on the potential signal raised + better tests * pep8 naming: exitcode => exit_code * rename test_InvocationError => test_invocation_error * exit code + signal name * terser note * remove blank line * add changelog fragment * remove "python" from expected_command_arg (fix appveyor)
resolved by #766 Hint for possible signal upon InvocationError |
When a command fails, you currently only get
ERROR: InvocationError: '/usr/bin/false'
, but the exitcode itself is useful/important, e.g. withpy.test using 5 for "no tests collected".
The following patch would provide that, by using a custom
__str__
method forInvocationError - but it does not handle the case where that might be missing (not all instances / calls to it provide it).
Maybe a custom
__init__
should be used to set the arguments as properties explicitly, and then use them?!This is related / similar to #192.
The text was updated successfully, but these errors were encountered: