ipc: Make sure server is always shut down in tests.
Hopefully fixes #947.
This commit is contained in:
parent
dd2a70e01f
commit
7ffff72368
@ -51,6 +51,18 @@ def short_tmpdir():
|
|||||||
yield py.path.local(tdir)
|
yield py.path.local(tdir)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.yield_fixture(autouse=True)
|
||||||
|
def shutdown_server():
|
||||||
|
"""If ipc.send_or_listen was called, make sure to shut server down."""
|
||||||
|
yield
|
||||||
|
try:
|
||||||
|
server = objreg.get('ipc-server')
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
server.shutdown()
|
||||||
|
|
||||||
|
|
||||||
@pytest.yield_fixture
|
@pytest.yield_fixture
|
||||||
def ipc_server(qapp, qtbot):
|
def ipc_server(qapp, qtbot):
|
||||||
server = ipc.IPCServer('qute-test')
|
server = ipc.IPCServer('qute-test')
|
||||||
@ -662,7 +674,6 @@ class TestSendOrListen:
|
|||||||
ret_client = ipc.send_or_listen(args)
|
ret_client = ipc.send_or_listen(args)
|
||||||
|
|
||||||
assert ret_client is None
|
assert ret_client is None
|
||||||
ret_server.shutdown()
|
|
||||||
|
|
||||||
@pytest.mark.posix # Unneeded on Windows
|
@pytest.mark.posix # Unneeded on Windows
|
||||||
def test_legacy_name(self, caplog, qtbot, args, legacy_server):
|
def test_legacy_name(self, caplog, qtbot, args, legacy_server):
|
||||||
@ -711,7 +722,6 @@ class TestSendOrListen:
|
|||||||
ret_client = ipc.send_or_listen(args)
|
ret_client = ipc.send_or_listen(args)
|
||||||
|
|
||||||
assert ret_client is None
|
assert ret_client is None
|
||||||
ret_server.shutdown()
|
|
||||||
|
|
||||||
@pytest.mark.posix # Unneeded on Windows
|
@pytest.mark.posix # Unneeded on Windows
|
||||||
def test_correct_socket_name(self, args):
|
def test_correct_socket_name(self, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user