Fix test failures on Python 3.14 (#394)

* Fix test failures on Python 3.14

As documented at
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop,
`get_event_loop` now fails if there is no active event loop. Since there
will never already be one at the top level of a file anyway, explicitly
create a new one every time.

* Reformat with black 2026 style
This commit is contained in:
Liam Murphy
2026-01-27 02:09:49 +11:00
committed by GitHub
parent 93ba29f916
commit aa90ab6844
9 changed files with 4 additions and 10 deletions

View File

@@ -7,7 +7,6 @@ import logging
import capnp
import calculator_capnp
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

View File

@@ -7,7 +7,6 @@ import logging
import capnp
import thread_capnp
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

View File

@@ -9,7 +9,6 @@ import socket
import capnp
import calculator_capnp
this_dir = os.path.dirname(os.path.abspath(__file__))
@@ -328,5 +327,5 @@ if __name__ == "__main__":
# Using asyncio.run hits an asyncio ssl bug
# https://bugs.python.org/issue36709
# asyncio.run(main(parse_args().host), loop=loop, debug=True)
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
loop.run_until_complete(capnp.run(main(parse_args().host)))

View File

@@ -10,7 +10,6 @@ import socket
import capnp
import calculator_capnp
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

View File

@@ -71,5 +71,5 @@ if __name__ == "__main__":
# Using asyncio.run hits an asyncio ssl bug
# https://bugs.python.org/issue36709
# asyncio.run(main(parse_args().host), loop=loop, debug=True)
loop = asyncio.get_event_loop()
loop = asyncio.new_event_loop()
loop.run_until_complete(capnp.run(main(parse_args().host)))

View File

@@ -10,7 +10,6 @@ import socket
import capnp
import thread_capnp
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)