Skip to content

Tests fail when using Python 3.14 #581

@martincostello

Description

@martincostello

While working on .NET 11 support for the OpenTelemetry .NET SDK, which uses this test suite as part of its CI validation, I found that the tests don't work on Python 3.14, which is included in the .NET 11 SDK container images.

You can see such a failure here from #580:

======================================================================
ERROR: setUpModule (test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/trace-context/trace-context/test/test.py", line 34, in setUpModule
    server = server or TestServer(host = '127.0.0.1', port = 7777, timeout = 3)
                       ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/trace-context/trace-context/test/server.py", line 78, in __init__
    self.loop = asyncio.get_event_loop()
                ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 715, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
                       % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.

----------------------------------------------------------------------
Ran 33 tests in 0.057s

I have a patch for this locally that seems to work, so I'll look to push up a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions