-
Notifications
You must be signed in to change notification settings - Fork 7
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
After is not called if test is aborted by SIGINT #17
Comments
You could catch |
On second thought, the panic would need to be in the same goroutine as the deferred Parallelism makes this tough to solve cleanly, but maybe we could introduce an option that stops testing on |
It looks like Go recently introduced a As a path forward, we could introduce an option that just stops new subtests from running on |
Here's what I'm thinking now:
To allow users to enable this, we could add:
This would also allow you to specify a test timeout via |
@benmoss would you mind testing out this branch? https://github.com/sclevine/spec/tree/spec-1.5-rc Just pass |
Seems good to me, still doesn't fix my exact problem of the test cleanup, but I guess that's just the upstream issue |
If you only hit Ctrl-C once, all of the After blocks should still execute. It may take a while for the tests to stop running, but you can use |
ctrl-c once doesn't seem to do anything: https://asciinema.org/a/EAbKe6nHvexc4F2rquiD3HFLg |
Ctrl-C once should:
If you have individual long-running specs, you could end them early when Unfortunately, I think this is the best we can do while using Go's testing package for parallelism. |
Got it, that seems to do the trick:
|
I know Ginkgo does this, and I'm sure it comes with some complexity, but is this a known/intentional feature that spec doesn't run any
After
code? Can you think of how I might be able to setup a signal handler in my own tests to call the After?The text was updated successfully, but these errors were encountered: