I’m running `./pants test ::` and I want to sort t...
# development
m
I’m running
./pants test ::
and I want to sort the tests by durations, with pytest I would do something like
--durations=0
Is there something similar with pants that allows me also to sort by slowest to fastest test?
c
I’m not aware of any such sorting between test targets (such as
python_tests
) but for a single target, you may pass your pytest args either in the configuration or on the command line:
./pants test :: — --durations=0
See https://www.pantsbuild.org/docs/python-test-goal#passing-arguments-to-pytest for more info 🙂
If you want to see the pytest output as it runs, this is likely interesting read as well: https://www.pantsbuild.org/docs/python-test-goal#running-tests-interactively
m
It’s not what I’m asking. I’m asking whether pants saved the runtime of actions and can output the runtime of tests
But it seems the answer is no, It makes it hard to flag bad tests
c
Oh, right. There’s the junit output that you can capture. Not sure if runtimes are recorded in that, though. https://www.pantsbuild.org/docs/python-test-goal#junit-xml-results
I’m obviously not familiar with what
--durations
does for pytest…
m
Junit might be what I’m looking for, thanks!
💯 1
w
Pants does store them, as well as their cache status: see the last comment on https://github.com/pantsbuild/pants/issues/13588 … they’re just not rendered yet.
i’d be really happy to mentor someone through finishing https://github.com/pantsbuild/pants/issues/13588, as i expect that it will be a fairly easy but really high value change!
👀 1
b
@witty-crayon-22786 maybe cross-post to #general as well since there's potential for this to be a first issue for someone not yet hanging out in #development.
n
I could help with this @witty-crayon-22786
🎉 1
w
ah, shoot! sorry i missed this. are you
@riisi
on github? responded to a question there
n
yep - no worries - that’s me 🙂
👍 1
Looking at the test duration output. Any thoughts on suggested console output / layout? Notes here - https://github.com/pantsbuild/pants/issues/13588#issuecomment-991863653
👀 1
👍 1
w
looks great! can further tweak alignment in the future