I have a Python unittest.TestCase
that sometime fails. To debug this, I would like to run automatically run it until it fails. I found https://pypi.org/project/pytest-repeat/ which looks like what I am looking for, but it explicitly says
Unfortunately pytest-repeat is not able to work with unittest.TestCase test classes. These tests will simply always run once, regardless of --count, and show a warning.
Is there something similar that works with unittest
?
As I am writing this, it occurs to me that a simple shell command might be the solution:
while pytest ...
do
echo Sadly, it passed again
done
Is that the actual solution, or is there some python tool that does what I want (possibly better in some way)?
Could a simple try
and except
work? Just have a while(true)
loop with a break
in the except
statement.
I'm fairly new to python so apologies if the question is way above this answer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.