Open JarnoRFB opened 5 years ago
Fair warning: I wouldn't really recommend using this yet -- I basically coded enough to fix a need I had in another project, and no more.
That being said, if you want to use it before I get around to properly documenting it: The "score" fixture (https://github.com/greschd/pytest-score/blob/master/pytest_score/_fixtures.py#L71) is what you want to use in your tests. It's a function which takes a numeric value (the score), and optionally you can set
less_is_better
for scores where lowering the value is the targetcutoff
causes the test to fail is the score is lower (higher if less_is_better
) than the cutofftag
: by default scores are per test, add unique tags if you need more than one score per test.
The scores (best, last, current) will then be printed to the terminal at the end of the test run, saved in HTML format in the "htmlscore" folder and serialized to the .pytest-score
file, both on the root directory of the test run.So, plenty to improve, but it'll do the basic job. More of a proof of concept than a finished plugin though.
I'll keep the issue open to remind me to add some documentation when (if?) I get around to polishing this.
Hey, thanks for making this open source! I have been looking for something like this. However, form the tests/readme I cannot really get how the library is supposed to be used. Maybe you could add a small section, describing how the usage in a pytest would look like.