cmd/go: add go test -skip to skip specific tests #41583
Comments
go test
CLIgo test
CLI
go test
CLIgo test
CLI
Do you have a specific suggestion? To run specific tests you can already write |
go test
CLIgo test
CLI
I didn't want to prescribe a solution but here's some off the top of my head
This doesn't scale if I have O(10s) of tests in a package and want to skip one or two |
hey @ianlancetaylor - do you have any additional questions or want me to clarify anything above? |
No, I'm good. This issue is in the proposal process now and will get into the proposal committee in due course. The committee looks at a lot of issues (see minutes at #33502), so it won't be immediately, but it shouldn't take too long. Thanks. |
Almost no one on earth understands how to write negation regexps correctly, so I would lean toward -skip if we do this. |
I can see only two reasonable definitions.
I have a slight preference for (1), because it treats the default value of the |
Does precedence mean the order the filters are applied in or which is used if both are given? If it's the order, then |
Yeah, it seems especially useful in the context of subtests:
|
The latter in my opinion |
I have almost moved some subtests into their own top level test function on a few occasions exactly because there was not a good way to skip some subset of them. I have also had to run |
It sounds like people are generally in favor of adding Do I have that right? Does anyone object to adding |
go test
CLI
Hmm. It would be unfortunate to have an easy way to skip specific tests but not specific benchmarks. I think it would make sense to either have |
Sounds good to me
Expanding the scope of |
A way to skip benchmarks would be welcome as well. The |
Instead of introducing a new flag, could we add some syntax to the existing flag? Let a pattern starting with This avoids introducing new flags ( |
Truthfully I was tripped up by this when I first encountered it |
@magical, further complications in the syntax for the |
@ChrisHines, I think the question is, would someone running I would argue that pretty much everyone would expect that to skip the sub-benchmark, so I suspect that a unified |
FWIW this is usually a bad idea, at least interactively, since you inevitably end up benchmarking broken code. (And boy can you make broken code run fast!) |
@magical, more magic in -run is not a good idea. The slash was not great either but is done. |
That's a fair point. I guess it depends on one's workflow. In my experience testing and benchmarking are distinct steps of the workflow. If the tests fail I don't want to wait for benchmarks to run since they would be meaningless. Once the tests pass and I am benchmarking I don't want to waste time rerunning the tests before getting the benchmark data. |
Does anyone object to doing this? |
No objection here. |
No objection
…On Wed, Oct 21, 2020 at 14:36 Chris Hines ***@***.***> wrote:
No objection here.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41583 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAERAQIEIIMXURBJQH2EMDSL4S3XANCNFSM4RXF7DKQ>
.
|
Based on the discussion, this seems like a likely accept. |
No change in consensus, so accepted. |
I hope it's okay that I removed the FinalCommentPeriod and WaitingForInfo labels; I don't think either applies at this point anymore. Is this issue up for grabs? I'd like to use this feature, and there's still a bit of time before the 1.17 freeze is upon us. |
I'll take the silence and reactions as a yes :) |
t.Skip()
is an option but it requires changing the test code.It's hard to write a correct regex to pass to the
-run
flag in order to skip specific tests. This is due to the lack of lookaheads in the regexp library. Previous discussion here: https://groups.google.com/g/golang-nuts/c/7qgSDWPIh_E?pli=1The text was updated successfully, but these errors were encountered: