Skip to content
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

make it easier to select tests #51

Closed
rogpeppe opened this issue Mar 24, 2021 · 2 comments
Closed

make it easier to select tests #51

rogpeppe opened this issue Mar 24, 2021 · 2 comments

Comments

@rogpeppe
Copy link

Currently to include test packages, you can use test=1(something) but that's awkward to type, not that easy to remember and requires shell quotes.

I find myself needing this qualifier a lot, because test code is a large part of any repository and a big part of refactoring calculations.

How about using a :test qualifier instead?

So, for example, ./...:test would include all the test code in ./....

./...:test:all would include all dependencies of all packages and tests below ..

@egonelbre
Copy link
Member

egonelbre commented Mar 26, 2021

There's a slight issue with including tests using a selector. In some sense the loading of packages happens before the selector is applied. https://github.com/loov/goda/blob/master/internal/pkgset/context.go#L64

There would also be a need to select "tests only" and packages with tests.

It certainly could be special-cased in terms of loading. i.e. if the expression contains :test then add the tests to the loading context.

Alternatively adding :test could "reload" the whole previous packages with tests included.

pkg:all:test -- load tests for all packages
pkg:test:all -- load all dependencies for `pkg` tests

But this makes it slightly awkward to load pkg+test.

Maybe the syntax needs to be extended to support something like pkg+:test?

@egonelbre
Copy link
Member

Maybe the latter syntax example should be :<op><selector>, then you can write:

pkg:+test
pkg:-test

pkg:-source

pkg:+imp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants