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

Can a project toggle test components? #9138

Closed
philderbeast opened this issue Jul 18, 2023 · 2 comments
Closed

Can a project toggle test components? #9138

philderbeast opened this issue Jul 18, 2023 · 2 comments

Comments

@philderbeast
Copy link
Collaborator

If I have a large project but only want to run a subset of the test suites how would I go about that with a project?

I can't imagine running flags through hundreds of packages to achieve this. It looks like the finest granularity in a project is the package and not a component.

What I can do now:

tests: False
package pkg-a {tests: True}

What I'd like is something like any one of the following:

tests: False
component pkg-a:test:test-1 {test: True}
tests: False
package pkg-a
    test-1: {test: True}
tests: [pkg-a:test:test-1]

What I'm doing at the moment (stopping to edit test-suites.txt):

$ ~/.local/bin/stack ide targets --tests 2> test-suites.txt
$ cabal test $(cat test-suites.txt | sed -n '/#/!p') --keep-going
@andreabedini
Copy link
Collaborator

You are correct in that cabal-install cannot enable/disable tests at the component level but only at the package level; this is a limitation of the solver (see #4087 but there are many issues around this).

I am not sure I understand the issue you are facing, but you can use the target syntax to specify with test to run. I.e. you can do cabal test pkg-a:test:test-1. Tests will have to be enabled though.

What do you wish to achieve by enabling a test component a the time?

I assume pkg-a is a project local package? I am not sure we can run tests for non-local packages.

@philderbeast
Copy link
Collaborator Author

Yes these were all local packages, about 400 of them. I wanted to have a way of running a subset of them using a project but ended up creating a script that calls each test individually using the target syntax you provided @andreabedini.

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

No branches or pull requests

2 participants