I have a tox file which run pytest on my project and export test results when all of them passed but when one of them failed, and I get an AssertionError, I can not save my logs in my results file. Have you any idea or solution to save logs even when tests failed?
Use the try
and except
statements to handle exceptions
Example:
try:
#put your pytest stuff here
except AssertionError:
pass
If all goes well your log should be saved in no time!