Currently I try to create an unit test which opens a file (with the corresponding application) and then the test-run should wait until the program is closed.
os.startfile
is, of course, completely non-blocking with no options to wait.
I'd recommend using the subprocess module, calling the Windows "start" command to open the file with the associated object, which does the same thing as os.startfile
, but allows you to wait for the process to finish.
e.g.:
subprocess.call(["start", my_file])