0

Following is the pseudo code I was about to do a python unit test:

def my_method():
    run asynchronous_job, which will write to output_file when it's done
    while True:
        if output_file was written (by asynchronous_job):
            break
        else:
            sleep one second

I was trying to get asynchronous_job mocked up, but then I don't know how to test the while loop behavior because output_file will never been written with asynchronous_job mocked. What is the best way to do the unit test for my_method regarding this issue?

Hailiang Zhang
  • 17,604
  • 23
  • 71
  • 117

0 Answers0