Closed wkCircle closed 1 year ago
Explanation: effect of pytest -ra
option
As documented in the doc of manaing pytest's output,
-r
flag can be used to display a “short test summary info” at the end of the test session, making it easy in large test suites to get a clear picture of all failures, skips, xfails, etc.-r
options accepts a number of characters after it, with a
used above meaning “all except passes”, ie the pass statement with or without output.
For more details, please see the official doc as hyperlinked above. In the PR I use this -ra
setting. An example screen shot will be demonstrated along the PR with all specific config in the pyproject.toml
.
With --tb=line
, we can show only one line per failure. Therefore I think the additional package pytest-lineno
is no longer needed.
I also found that, in the coverage report (as shown below), most missing lines are related to NotImplementedError
or unexecuted __str__
, __hash__
etc. This affects the coverage rate and makes it harder to reach high coverage standard.
I see that many functions with NotImplementedError
should not be a problem once we implement them in the future, yet __str__
, __hash__
etc are still captured by the coverage report, which are trivial.
A possible solution would be to either ignore them by adding them to white-list, or add (trivial) tests for them.
If we want to ignore the trivial lines mentioned, then we may need to switch to another package coverage since currently I didn't see pytest-cov
supports it as discussed in their issue 428.
I will make a new PR.
The issue is intended to configure the pytest as a pre-step to have a complete CI build. The pytest configuration will be specified in
pyproject.toml
for convenience and easy integration with other tools in the future (though other file names are also supported via pytest).The configuration should include