I am developing unit test for code that use Google oauth2client.tools run_flow()
. The problem is, this function will call Python webbrowser.open()
, that will eventually (cmiiw), exit itself by calling sys.exit()
. Therefore, even if I halt the code execution using threading.Event.wait()
, it will eventually terminate, without continuing the rest of the unit testing code.
I have read this SO answer that previously was my problem, but now I still faced with this webbrowser.open()
issue.
Any idea on how to solve this?
webbrowser.open
so that it doesn't actually run. (You might even want to mockrun_flow
, if it isn't essential to your test that it actually be called.) It's hard to be more specific without seeing the code you want to test and knowing what exactly you are testing. – Albumosesys.exit
whit some other function? – Jorgenson