The sleep call in the start_browser function does not block the tests, because it runs inside an other thread. But: If I don't mock it out, the test will always fail, because it is faster than the sleeping thread. Even when I mock it out (which is already the case) the test is sometimes faster than the function and fails. That's why I inserted this line. If I remove it, the test will fail or not depending on the quickness of the testing machine. This is not, what we want. The sleep 0.1 seems to be a compromise. I can leave it out, but then I need another solution or I have to disable the test.