https://pantsbuild.org/ logo
a

ambitious-xylophone-5772

10/20/2022, 3:23 PM
Hi all, had another question: does pants support caching individual tests within a pytest target?
h

happy-kitchen-89482

10/20/2022, 4:03 PM
It caches per test file, not individual test functions within a file, if that’s what you mean?
a

ambitious-xylophone-5772

10/20/2022, 4:04 PM
Yeah that’s what I mean
Was wondering if it would be possible to cache at the individual test function level
c

curved-television-6568

10/20/2022, 4:23 PM
there are pytest plugins for that, I believe, then you “just” need to figure out how to plug those through into each invocation..
r

rough-vase-83553

10/20/2022, 5:04 PM
It might not be very useful to cache those since dependency resolution won't be able to figure out which dependencies correspond to each test and always rerun (all / none) of them. It helps with rerunning flaky tests though.
👍 1
h

happy-kitchen-89482

10/20/2022, 5:15 PM
Yeah, this will not be straightforward, although it is something we’ve thought about
The usual advice is to break up the test files…
👍 1
a

ambitious-xylophone-5772

10/20/2022, 5:29 PM
Ya our go to so far has been to break up test files.
Thanks all!
3 Views