Skip to content

Padding repetition number? #87

@karrukola

Description

@karrukola

Hello,
first of all, thank you for this plugin and all of your other work.

Would you be OK to update the test name by padding the iteration number?
I foresee a benefit in consuming the reports.
For instance when used in conjunction with pytest-html, sorting the tests by name would happen properly in the HTML report.

Right now, if I repeat a test 10 times, sorting the tests by name would look like:

test_something.py::test_do_nothing[1-10]
test_something.py::test_do_nothing[10-10] # this is out of order
test_something.py::test_do_nothing[2-10]
test_something.py::test_do_nothing[3-10]
# [...]

By padding wih either 0 or ' ', simple sorting would work

PASSED test_something.py::test_do_nothing[ 1-10]
PASSED test_something.py::test_do_nothing[ 2-10]
PASSED test_something.py::test_do_nothing[ 3-10]
# [...]
PASSED test_something.py::test_do_nothing[10-10]

I also prefer the way it gets printed on console during execution, but it is just a matter of personal taste.

I am happy to submit a working patch, if you like this proposal.
In case, let me know which padding character you prefer between 0 or ' '.

Kind regards,
Filippo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions