darrenburns / ward

Ward is a modern test framework for Python with a focus on productivity and readability.
https://ward.readthedocs.io
MIT License
1.21k stars 53 forks source link

Pad parameterized test index in output #103

Closed thebigmunch closed 4 years ago

thebigmunch commented 4 years ago

This would be so all of the output for these tests line up when the total tests has more digits than some of the test indexes. E.g:

PASS  test_api:41 [ 1/22]: [determine_format] Filepath (test-flac-0-duration.flac)
PASS  test_api:41 [ 2/22]: [determine_format] Filepath (test-flac-application.flac)
PASS  test_api:41 [ 3/22]: [determine_format] Filepath (test-flac-cuesheet.flac)
PASS  test_api:41 [ 4/22]: [determine_format] Filepath (test-flac-padding.flac)
PASS  test_api:41 [ 5/22]: [determine_format] Filepath (test-flac-seektable.flac)
PASS  test_api:41 [ 6/22]: [determine_format] Filepath (test-flac-vorbis-id3v24.flac)
PASS  test_api:41 [ 7/22]: [determine_format] Filepath (test-flac-vorbis.flac)
PASS  test_api:41 [ 8/22]: [determine_format] Filepath (test-mp3-apev2.mp3)
PASS  test_api:41 [ 9/22]: [determine_format] Filepath (test-mp3-cbr-2-frames.mp3)
PASS  test_api:41 [10/22]: [determine_format] Filepath (test-mp3-id3v1.mp3)
PASS  test_api:41 [11/22]: [determine_format] Filepath (test-mp3-id3v22.mp3)
PASS  test_api:41 [12/22]: [determine_format] Filepath (test-mp3-id3v23.mp3)
PASS  test_api:41 [13/22]: [determine_format] Filepath (test-mp3-id3v24.mp3)
PASS  test_api:41 [14/22]: [determine_format] Filepath (test-mp3-lame-abr.mp3)
PASS  test_api:41 [15/22]: [determine_format] Filepath (test-mp3-lame-cbr.mp3)
PASS  test_api:41 [16/22]: [determine_format] Filepath (test-mp3-lame-no-bitrate-mode.mp3)
PASS  test_api:41 [17/22]: [determine_format] Filepath (test-mp3-lame-vbr.mp3)
PASS  test_api:41 [18/22]: [determine_format] Filepath (test-mp3-sync-branch.mp3)
PASS  test_api:41 [19/22]: [determine_format] Filepath (test-mp3-vbri.mp3)
PASS  test_api:41 [20/22]: [determine_format] Filepath (test-mp3-xing-0-num-frames.mp3)
PASS  test_api:41 [21/22]: [determine_format] Filepath (test-wav-id3v23.wav)
PASS  test_api:41 [22/22]: [determine_format] Filepath (test-wav-riff.wav)

vs the current:

PASS  test_api:41 [1/22]: [determine_format] Filepath (test-flac-0-duration.flac)
PASS  test_api:41 [2/22]: [determine_format] Filepath (test-flac-application.flac)
PASS  test_api:41 [3/22]: [determine_format] Filepath (test-flac-cuesheet.flac)
PASS  test_api:41 [4/22]: [determine_format] Filepath (test-flac-padding.flac)
PASS  test_api:41 [5/22]: [determine_format] Filepath (test-flac-seektable.flac)
PASS  test_api:41 [6/22]: [determine_format] Filepath (test-flac-vorbis-id3v24.flac)
PASS  test_api:41 [7/22]: [determine_format] Filepath (test-flac-vorbis.flac)
PASS  test_api:41 [8/22]: [determine_format] Filepath (test-mp3-apev2.mp3)
PASS  test_api:41 [9/22]: [determine_format] Filepath (test-mp3-cbr-2-frames.mp3)
PASS  test_api:41 [10/22]: [determine_format] Filepath (test-mp3-id3v1.mp3)
PASS  test_api:41 [11/22]: [determine_format] Filepath (test-mp3-id3v22.mp3)
PASS  test_api:41 [12/22]: [determine_format] Filepath (test-mp3-id3v23.mp3)
PASS  test_api:41 [13/22]: [determine_format] Filepath (test-mp3-id3v24.mp3)
PASS  test_api:41 [14/22]: [determine_format] Filepath (test-mp3-lame-abr.mp3)
PASS  test_api:41 [15/22]: [determine_format] Filepath (test-mp3-lame-cbr.mp3)
PASS  test_api:41 [16/22]: [determine_format] Filepath (test-mp3-lame-no-bitrate-mode.mp3)
PASS  test_api:41 [17/22]: [determine_format] Filepath (test-mp3-lame-vbr.mp3)
PASS  test_api:41 [18/22]: [determine_format] Filepath (test-mp3-sync-branch.mp3)
PASS  test_api:41 [19/22]: [determine_format] Filepath (test-mp3-vbri.mp3)
PASS  test_api:41 [20/22]: [determine_format] Filepath (test-mp3-xing-0-num-frames.mp3)
PASS  test_api:41 [21/22]: [determine_format] Filepath (test-wav-id3v23.wav)
PASS  test_api:41 [22/22]: [determine_format] Filepath (test-wav-riff.wav)

A small annoyance, to be sure. But it's something I always do for my numbered output if the total number is known ahead of time.

darrenburns commented 4 years ago

Sounds good -- definitely agreed it looks cleaner! Happy for anyone to make a PR for this sort of thing 😄

darrenburns commented 4 years ago

Thanks for the contribution @thebigmunch, it's been included in 0.31.0b0 which is now available on PyPI! I have also added you to the contributors list in README.md.

https://pypi.org/project/ward/