Skip to content

Commit 96b7ed3

Browse files
cjwatsonfantix
andauthored
test: fix task name for Python 3.13.3/3.14 (#662)
* also fixed CI not to use Cython 3.1beta, which is breaking many uvloop tests --------- Co-authored-by: Fantix King <[email protected]>
1 parent 5680792 commit 96b7ed3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/workflows/tests.yml

-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ jobs:
5757
5858
- name: Install Python Deps
5959
if: steps.release.outputs.version == 0
60-
env:
61-
PIP_PRE: ${{ matrix.python-version == '3.13' && '1' || '0' }}
6260
run: |
6361
pip install -e .[test,dev]
6462

tests/test_base.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,14 @@ def get_name(self):
576576
async def coro():
577577
pass
578578

579-
factory = lambda loop, coro, **kwargs: MyTask(
580-
coro, loop=loop, **kwargs
581-
)
579+
def factory(loop, coro, **kwargs):
580+
task = MyTask(coro, loop=loop, **kwargs)
581+
# Python moved the responsibility to set the name to the Task
582+
# class constructor, so MyTask.set_name is never called by
583+
# Python's create_task. Compensate for that here.
584+
if self.is_asyncio_loop() and "name" in kwargs:
585+
task.set_name(kwargs["name"])
586+
return task
582587

583588
self.assertIsNone(self.loop.get_task_factory())
584589
task = self.loop.create_task(coro(), name="mytask")

0 commit comments

Comments
 (0)