adamchainz / django-rich

Extensions for using Rich with Django.
MIT License
121 stars 10 forks source link

Added table output for slowest tests #213

Closed adamchainz closed 2 months ago

adamchainz commented 2 months ago

Following this discussion on abandoned PR: https://github.com/adamchainz/django-rich/pull/30#issuecomment-2282269423

I found that using a Rich Table to draw the results looks quite nice:

Xnapper-2024-08-10-23 18 52

@smithdc1 any thoughts?

smithdc1 commented 2 months ago

Hi Adam -- wow that was quick! A few comments this morning before I head off to the office.

image

adamchainz commented 2 months ago

Hi Adam -- wow that was quick!

Heh, yeah, I was up for a low-stakes open source issue to take my mind off work things!

A few comments this morning before I head off to the office.

Thanks! 🙏

  • I like using the table layout. One suggestion would be to switch the order of the columns. I think typically in a table you'd have the description first and then the value.

Yes, true. I copied the default output from unittest. I can see two reasons to keep duration first, though. First, it’s much shorter - test paths can get very long, clipping the durations. Second, the durations are probably more relevant information. If your slowest test takes <1s, you might not care about optimizing. If it’s, say, 10s, then you might perk up and be interested, regardless of which test it is

So I think I’ll keep order as-is for now.

  • In your image the table is very green, but it is white for me. That must be a terminal setting?

Yeah, green-on-black is my terminal theme, because I’m a cool hacker from The Matrix.

  • I wondered about using table.caption for the message about hidden durations, but I don't really have a strong opinion on doing this way vs the layout currently proposed. See img below for how it looks without adding any customisation to the caption style/justification.

Yes, the caption feature is neat. Changing to use it.