tasty icon indicating copy to clipboard operation
tasty copied to clipboard

It would be nice to be able to limit the number of jobs used by `TestTree`s

Open michaelpj opened this issue 1 year ago • 6 comments

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).

michaelpj avatar Feb 03 '24 13:02 michaelpj

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.

carbolymer avatar Mar 04 '24 13:03 carbolymer

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 :thinking:

michaelpj avatar Mar 04 '24 15:03 michaelpj

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!

michaelpj avatar Mar 04 '24 15:03 michaelpj

@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.

Bodigrim avatar Mar 04 '24 19:03 Bodigrim

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

dyniec avatar Jun 09 '24 14:06 dyniec

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

Bodigrim avatar Jun 09 '24 15:06 Bodigrim