Fix and improve a bunch of tests

This commit is contained in:
Lasse Blaauwbroek
2023-06-08 02:29:54 +02:00
parent b29f18ed64
commit af99e388fb
4 changed files with 46 additions and 88 deletions

View File

@@ -117,8 +117,8 @@ def run_subprocesses(
serverp.kill()
def test_async_calculator_example(cleanup):
address = "{}:36432".format(hostname)
def test_async_calculator_example(unused_tcp_port, cleanup):
address = "{}:{}".format(hostname, unused_tcp_port)
server = "async_calculator_server.py"
client = "async_calculator_client.py"
run_subprocesses(address, server, client)
@@ -132,57 +132,36 @@ def test_addressbook_example(cleanup):
assert ret == 0
@pytest.mark.skipif(
sys.platform == "win32",
reason="""
Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop.
See https://github.com/capnproto/pycapnp/issues/196
""",
)
def test_async_example(cleanup):
address = "{}:36434".format(hostname)
def test_async_example(unused_tcp_port, cleanup):
address = "{}:{}".format(hostname, unused_tcp_port)
server = "async_server.py"
client = "async_client.py"
run_subprocesses(address, server, client)
@pytest.mark.skipif(
sys.platform == "win32",
reason="""
Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop.
See https://github.com/capnproto/pycapnp/issues/196
""",
)
def test_ssl_async_example(cleanup):
address = "{}:36435".format(hostname)
def test_ssl_async_example(unused_tcp_port, cleanup):
address = "{}:{}".format(hostname, unused_tcp_port)
server = "async_ssl_server.py"
client = "async_ssl_client.py"
run_subprocesses(address, server, client, ipv4_force=False)
@pytest.mark.skipif(
sys.platform == "win32",
reason="""
Asyncio bug with libcapnp timer, likely due to asyncio starving some event loop.
See https://github.com/capnproto/pycapnp/issues/196
""",
)
def test_ssl_reconnecting_async_example(cleanup):
address = "{}:36436".format(hostname)
def test_ssl_reconnecting_async_example(unused_tcp_port, cleanup):
address = "{}:{}".format(hostname, unused_tcp_port)
server = "async_ssl_server.py"
client = "async_reconnecting_ssl_client.py"
run_subprocesses(address, server, client, ipv4_force=False)
def test_async_ssl_calculator_example(cleanup):
address = "{}:36437".format(hostname)
def test_async_ssl_calculator_example(unused_tcp_port, cleanup):
address = "{}:{}".format(hostname, unused_tcp_port)
server = "async_ssl_calculator_server.py"
client = "async_ssl_calculator_client.py"
run_subprocesses(address, server, client, ipv4_force=False)
def test_async_socket_message_example(cleanup):
address = "{}:36438".format(hostname)
def test_async_socket_message_example(unused_tcp_port, cleanup):
address = "{}:{}".format(hostname, unused_tcp_port)
server = "async_socket_message_server.py"
client = "async_socket_message_client.py"
run_subprocesses(address, server, client)