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:
2
.github/workflows/wheels.yml
vendored
2
.github/workflows/wheels.yml
vendored
@@ -53,7 +53,7 @@ jobs:
|
|||||||
CIBW_ARCHS: ${{ matrix.arch }}
|
CIBW_ARCHS: ${{ matrix.arch }}
|
||||||
# TODO: Disable building PyPy wheels. If the build system gets modernized, this should be
|
# TODO: Disable building PyPy wheels. If the build system gets modernized, this should be
|
||||||
# auto-detected based on the Cython dependency.
|
# auto-detected based on the Cython dependency.
|
||||||
CIBW_SKIP: pp* cp314*
|
CIBW_SKIP: pp*
|
||||||
CIBW_TEST_REQUIRES: pytest pytest-asyncio
|
CIBW_TEST_REQUIRES: pytest pytest-asyncio
|
||||||
CIBW_TEST_COMMAND: pytest {project}
|
CIBW_TEST_COMMAND: pytest {project}
|
||||||
# Only needed to make the macosx arm64 build work
|
# Only needed to make the macosx arm64 build work
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ SSL/TLS setup effectively wraps the socket transport. You'll need an SSL certifi
|
|||||||
Due to a `bug <https://bugs.python.org/issue36709>`_ in Python 3.8 asyncio client needs to be initialized in a slightly different way::
|
Due to a `bug <https://bugs.python.org/issue36709>`_ in Python 3.8 asyncio client needs to be initialized in a slightly different way::
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
loop.run_until_complete(capnp.run(main(parse_args().host)))
|
loop.run_until_complete(capnp.run(main(parse_args().host)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import logging
|
|||||||
import capnp
|
import capnp
|
||||||
import calculator_capnp
|
import calculator_capnp
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import logging
|
|||||||
import capnp
|
import capnp
|
||||||
import thread_capnp
|
import thread_capnp
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import socket
|
|||||||
import capnp
|
import capnp
|
||||||
import calculator_capnp
|
import calculator_capnp
|
||||||
|
|
||||||
|
|
||||||
this_dir = os.path.dirname(os.path.abspath(__file__))
|
this_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
@@ -328,5 +327,5 @@ if __name__ == "__main__":
|
|||||||
# Using asyncio.run hits an asyncio ssl bug
|
# Using asyncio.run hits an asyncio ssl bug
|
||||||
# https://bugs.python.org/issue36709
|
# https://bugs.python.org/issue36709
|
||||||
# asyncio.run(main(parse_args().host), loop=loop, debug=True)
|
# 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)))
|
loop.run_until_complete(capnp.run(main(parse_args().host)))
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import socket
|
|||||||
import capnp
|
import capnp
|
||||||
import calculator_capnp
|
import calculator_capnp
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|||||||
@@ -71,5 +71,5 @@ if __name__ == "__main__":
|
|||||||
# Using asyncio.run hits an asyncio ssl bug
|
# Using asyncio.run hits an asyncio ssl bug
|
||||||
# https://bugs.python.org/issue36709
|
# https://bugs.python.org/issue36709
|
||||||
# asyncio.run(main(parse_args().host), loop=loop, debug=True)
|
# 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)))
|
loop.run_until_complete(capnp.run(main(parse_args().host)))
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import socket
|
|||||||
import capnp
|
import capnp
|
||||||
import thread_capnp
|
import thread_capnp
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|||||||
1
setup.py
1
setup.py
@@ -21,7 +21,6 @@ sys.path.insert(1, _this_dir)
|
|||||||
from buildutils.build import build_libcapnp
|
from buildutils.build import build_libcapnp
|
||||||
from buildutils.bundle import fetch_libcapnp
|
from buildutils.bundle import fetch_libcapnp
|
||||||
|
|
||||||
|
|
||||||
MAJOR = 2
|
MAJOR = 2
|
||||||
MINOR = 2
|
MINOR = 2
|
||||||
MICRO = 2
|
MICRO = 2
|
||||||
|
|||||||
Reference in New Issue
Block a user