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

It would be nice to be able to limit the number of jobs used by TestTrees #406

Open
michaelpj opened this issue Feb 3, 2024 · 6 comments

Comments

@michaelpj
Copy link
Contributor

From looking at the code and experimentation, I believe that the NumThreads option only takes effect at the top-level. So you can't, for example, limit a particular test tree to be run with only one job (in case the tests interfere with each other).

@carbolymer
Copy link

carbolymer commented Mar 4, 2024

I think sequentialTestGroup can be used for enforcing sequential execution on more granular level. Haven't tested how it behaves if you mix it with testGroup.

@michaelpj
Copy link
Contributor Author

And that led me to ExecutionMode, which seems like it's exactly what I want but sadly isn't exported. Maybe there's a reason why it's only available through sequentialTestGroup, but I'm not sure 🤔

@michaelpj
Copy link
Contributor Author

Indeed, sequentialTestGroup does not do what I want, since it only makes the tests directly in the group run sequentially, whereas tests in nested groups continue to execute in parallel. I really do just want to set the execution mode to sequential for a whole test tree!

@Bodigrim
Copy link
Collaborator

Bodigrim commented Mar 4, 2024

@michaelpj it is admittedly awkward, but you can pattern-match on

PlusTestOptions mkSequential = sequentialTestGroup "foo" AllFinish []

and then

defaultMain $ PlusTestOptions mkSequential testTree

I'm curious if it works, please tell if you give it a try.

@dyniec
Copy link

dyniec commented Jun 9, 2024

contructors of TestTree aren't exported, so PlusTestOptions is not visible :/

@Bodigrim
Copy link
Collaborator

Bodigrim commented Jun 9, 2024

@dyniec constructors of TestTree are exported from https://hackage.haskell.org/package/tasty-1.5/docs/Test-Tasty-Runners.html#t:TestTree

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

4 participants