https://pantsbuild.org/ logo
m

melodic-thailand-99227

12/01/2021, 8:57 AM
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

curved-television-6568

12/01/2021, 9:06 AM
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

melodic-thailand-99227

12/01/2021, 9:14 AM
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

curved-television-6568

12/01/2021, 9:18 AM
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

melodic-thailand-99227

12/01/2021, 9:33 AM
Junit might be what I’m looking for, thanks!
💯 1
w

witty-crayon-22786

12/01/2021, 5:34 PM
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

busy-vase-39202

12/02/2021, 3:03 PM
@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

nutritious-hair-72580

12/02/2021, 3:40 PM
I could help with this @witty-crayon-22786
🎉 1
w

witty-crayon-22786

12/06/2021, 5:49 PM
ah, shoot! sorry i missed this. are you
@riisi
on github? responded to a question there
n

nutritious-hair-72580

12/07/2021, 9:38 AM
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

witty-crayon-22786

12/13/2021, 5:38 PM
looks great! can further tweak alignment in the future