def main_window(qtbot, request): if request.param == "remote": server.try_kill_server() viewer = Viewer(show=False) win = MainWindow(viewer=viewer, remote=request.param == "remote") config_path = os.path.dirname(os.path.abspath(__file__)) + "/test_config.cfg" win._mmc.loadSystemConfiguration(config_path) try: yield win finally: viewer.close()
def test_multi_viewers_dont_clash(qapp): v1 = Viewer(show=False, title='v1') v2 = Viewer(show=False, title='v2') assert not v1.grid.enabled assert not v2.grid.enabled v1.window.activate() # a click would do this in the actual gui v1.window._qt_viewer.viewerButtons.gridViewButton.click() assert not v2.grid.enabled assert v1.grid.enabled v1.close() v2.close()
def test_run_outside_ipython(qapp, monkeypatch): """Test that we don't incorrectly give ipython the event loop.""" assert not _ipython_has_eventloop() v1 = Viewer(show=False) assert not _ipython_has_eventloop() v2 = Viewer(show=False) assert not _ipython_has_eventloop() with monkeypatch.context() as m: mock_exec = Mock() m.setattr(qapp, 'exec_', mock_exec) run() mock_exec.assert_called_once() v1.close() v2.close()