问题
I want to completely custom tests results output.
In unittest
I can implement my own test runner by example of unittest.TextTestRunner
. How can I do the same in pytest
?
回答1:
You'll need to work with pytest
hooks:
py.test calls hook functions to implement initialization, running, test execution and reporting.
Also see:
- py.test code snippets
- pycon tutorial session (it also goes through using hooks)
来源:https://stackoverflow.com/questions/18496496/pytest-custom-output-of-test-results