def test_project_managers_new_project_will_cause_project_to_be_opend_in_main_window(
self, other=None):
ds = self.aw.pm.project_data
# see run_in_a_thread
if (other):
self = other
with mock.patch.object(self.aw, '_display_project', autospec=True) as mock__display_project:
with mock.patch.object(ds, "get_epanetfile", autospect=True) as mock_get_epanetfile:
mock_get_epanetfile.return_value = networks[0]
self.aw.pm.new_project()
self.aw.pm.wait_to_finish()
QApplication.processEvents() # this is very important before the assertion.
# that is because we are not testing this within the Qt's main loop.
time.sleep(0.1)
mock__display_project.assert_called_with(self.aw.pm.workerthread.result)
test_rrpamwds_projects.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录