How to prevent unit testing from exiting when calling webbrowser.open()?

隐身守侯 提交于 2019-12-13 05:51:30

问题


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?

来源:https://stackoverflow.com/questions/31879381/how-to-prevent-unit-testing-from-exiting-when-calling-webbrowser-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!