Ejemplo n.º 1
0
def test_frozen_server():
    global backend_manager
    win = QtWidgets.QMainWindow()
    backend_manager = BackendManager(win)
    with pytest.raises(NotRunning):
        backend_manager.send_request(
            backend.echo_worker, 'some data', on_receive=_on_receive)
    backend_manager.start('server.exe')
Ejemplo n.º 2
0
def test_frozen_server():
    global backend_manager
    win = QtWidgets.QMainWindow()
    backend_manager = BackendManager(win)
    with pytest.raises(NotRunning):
        backend_manager.send_request(backend.echo_worker,
                                     'some data',
                                     on_receive=_on_receive)
    backend_manager.start('server.exe')
Ejemplo n.º 3
0
def test_client_server():
    """
    Checks that the client-server works as expected. We will send
    a request using the echo worker and assert it has the same data as we send,
    providing assurance that the client-server communication and protocol is
    OK.

    Once the result has been received we quit the qt app.
    """
    global backend_manager
    win = QtWidgets.QMainWindow()
    backend_manager = BackendManager(win)
    with pytest.raises(NotRunning):
        backend_manager.send_request(backend.echo_worker,
                                     'some data',
                                     on_receive=_on_receive)
    backend_manager.start(os.path.join(os.getcwd(), 'server.py'))
    backend_manager._process.started.connect(_send_request)
    QTest.qWait(1000)
    backend_manager.stop()
    del backend_manager
    del win
Ejemplo n.º 4
0
def test_client_server():
    """
    Checks that the client-server works as expected. We will send
    a request using the echo worker and assert it has the same data as we send,
    providing assurance that the client-server communication and protocol is
    OK.

    Once the result has been received we quit the qt app.
    """
    global backend_manager
    win = QtWidgets.QMainWindow()
    backend_manager = BackendManager(win)
    with pytest.raises(NotRunning):
        backend_manager.send_request(
            backend.echo_worker, 'some data', on_receive=_on_receive)
    backend_manager.start(os.path.join(os.getcwd(), 'server.py'))
    backend_manager._process.started.connect(_send_request)
    QTest.qWait(1000)
    backend_manager.stop()
    del backend_manager
    del win