-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
proposal: cmd/go: go test: allow -run
and -skip
flags to specify a package
#68401
Comments
-run
and -skip
flag to specify a package-run
and -skip
flags to specify a package
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
-run
and -skip
flags to specify a package-run
and -skip
flags to specify a package
How would it distinguish package paths from subtests? Also how specifically would this interact with existing support for arbitrary regexes? |
I think |
But |
I think the issues @rittneje mentioned make this complicated to address. I think we haven't really needed this because it's not common to have many different packages with tests that are named the same. I'm curious what your use case looks like |
We do have several tests currently with the same name across different packages in our e2e tests module. One package corresponds to one feature, one test corresponds to one target remote infrastructure - so we have I agree we should rather rename tests to be unique, thinking about having a custom linter that ensure no homonym across this module specifically. |
@pducolin Thanks for the example. Have you needed to run or skip tests in packages in a way that can't be done using the currently available options? |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
@matloob we do have a use case where we need to skip a single test in packages that contain homonyms, in our e2e tests module. As an example we have
Both are executed within the same job on the CI. We have an internal tool to mark a single test as flaky, either in code or in a file. We want to ensure the flakes marker behaviour is the same. This allows to skip a known flaky test on a dev pipeline. It still runs on Today the in code marker allows to skip a single test context We don't have the same support with the file based marker, as we cannot isolate a test in calls to We need the file based marker as some test names are dynamic |
Proposal Details
This proposal was initially mentioned in the issue for the addition of the
-skip
flag: #41583 (comment)It would be very convenient to be able to specify the package in which the test lives when skipping or running a test. The command would look like that:
go test -run "path/to/pkgA.TestToto" ./...
to run only the testTestToto
that lives inpkgA
orgo test -skip "path/to/pkgA.TestToto" ./...
to skip only this test. We would keep the default behavior if no packages are specifiedThe current implementation has some limits because you cannot easily deal with tests that have the same name across packages. For example if I have a test named
TestToto
inpkgA
and a test with the same name inpkgB
. I cannot skip onlyTestToto
inpkgA
with the commandgo test -skip TestToto ./...
It would be useful for us to skip only some flaky tests in specific packages.
The text was updated successfully, but these errors were encountered: