@pytest.fixture()
def proc(qtbot, caplog):
 p = guiprocess.GUIProcess('testprocess')
 (yield p)
 if (p._proc.state() == QProcess.Running):
  with caplog.at_level(logging.ERROR):
   with qtbot.waitSignal(p.finished, timeout=10000, raising=False) as blocker:
    p._proc.terminate()
   if (not blocker.signal_triggered):
    p._proc.kill()

@ pytest . fixture ( ) def proc ( qtbot , caplog ) : p = guiprocess . GUIProcess ( 'testprocess' ) ( yield p ) if ( p . _proc . state ( ) == QProcess . Running ) : with caplog . at_level ( logging . ERROR ) : with qtbot . waitSignal ( p . finished , timeout = 10000 , raising = False ) as blocker : p . _proc . terminate ( ) if ( not blocker . signal_triggered ) : p . _proc . kill ( )
a fixture providing a guiprocess and cleaning it up after the test .