I am trying to use pytest to create some sort of automation suite. The product suite I am trying to write around communicates over network interface. I am using assert statements like
assert A == B
The main issue I want to address is this:
B takes different amounts of time to reach the desired value (e.g.: sometimes 2 seconds, sometimes 5 seconds)
Is it possible to implement an assert statement which kind of executes the given condition for a certain number of times with a delay and then assert?
assert A == B, 5, 5.0, "Still it failed"
The above statement would mean: "try A == B 5 times with 5.0 second delay between each iteration and after that emit given error if it still fails."