run: Support system signal as a coverage report dump trigger.#1998
run: Support system signal as a coverage report dump trigger.#1998ark-g wants to merge 13 commits into
Conversation
Signed-off-by: Arkady Gilinsky <9481855+ark-g@users.noreply.github.com>
nedbat
left a comment
There was a problem hiding this comment.
A few small changes. I'll adjust the English description once this merges.
| ) | ||
|
|
||
| dump_signal = optparse.make_option( | ||
| '', '--dump_signal', action='store', metavar='DUMP_SIGNAL', |
There was a problem hiding this comment.
| '', '--dump_signal', action='store', metavar='DUMP_SIGNAL', | |
| '', '--dump-signal', action='store', metavar='DUMP_SIGNAL', |
Options use hyphens, not underscores.
| help="Display version information and exit.", | ||
| ) | ||
|
|
||
| dump_signal = optparse.make_option( |
There was a problem hiding this comment.
Overall, I think this should be called "save signal" instead of "dump signal" throughout.
There was a problem hiding this comment.
These make_option definitions are in rough alphabetical order, so this should be further up.
| Opts.parallel_mode, | ||
| Opts.source, | ||
| Opts.timid, | ||
| Opts.dump_signal, |
|
Thanks for this! I want to have tests for this feature. |
* Set options in alphabetical order * Rename "dump-signal" to "save-signal" Signed-off-by: Arkady Gilinsky <9481855+ark-g@users.noreply.github.com>
Hi, Thanks. |
|
Thanks, what are your thoughts on a test? Let me know how far you want to take this, I can take it over when you want. |
|
I think that test should run some script with 2 stages. But for the above I need to run script in background and to communicate with the running script dynamically (to monitor it's output). |
|
The test would have to be something like that, but I don't want it to take 10 seconds. I think it would be enough to have two cases in the test: in both, start an infinite loop process with |
|
BTW, we also need to do the right thing on Windows. I think it's best to add "not on Windows" to the option help, and print an error if it's used on Windows. The test should check this also. |
Do you have an example how to initiate infinite loop process in existing test infrastructure or I should use Subprocess module in the test ? |
Signed-off-by: Arkady Gilinsky <9481855+ark-g@users.noreply.github.com>
optparse catches the problem of an incorrect signal name, we don't need to.
I do not see much more purpose on the second test (with only KILL signal), but as you wish ... ;) |
Signed-off-by: Arkady Gilinsky <9481855+ark-g@users.noreply.github.com>
|
Did you see this pull request? ark-g#1 It has some other changes for the code in cmdline.py. I wanted the test without the signal to show that the signal is needed to get the data file. |
I think that the first test is also demonstrating this fact, since the final coverage report doesn't include the line that is sending KILL signal, but does include the line with USR1 signal. Do you think that I can merge this PR ? |
|
I want you to take the changes I gave you in the pull request in your repo. |
Now half of tests failed |
|
You need to merge the pull request in your repo. I can't do it, and there will be conflicts to resolve. |
Signed-off-by: Arkady Gilinsky <9481855+ark-g@users.noreply.github.com>
556c4a1 to
ff696ab
Compare
Implement a feature that allows users to generate a coverage report by sending a signal. This is particularly useful for obtaining coverage reports from continuously running Python scripts, such as server implementations or monitoring utilities.
Currently supported only two signals SIGUSR1 and SIGUSR2.