https://github.com/python/cpython/commit/c77e98a4ea8ebfaddf2c73923833c9d2dd0ec3f1
commit: c77e98a4ea8ebfaddf2c73923833c9d2dd0ec3f1
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2026-09-22T11:03:43Z
summary:

[3.14] gh-157788: Fix `test_long_task_name_is_truncated` by not hardcoding main 
task name (GH-157911) (#157942)

Co-authored-by: Hugo van Kemenade <[email protected]>

files:
M Lib/test/test_external_inspection.py

diff --git a/Lib/test/test_external_inspection.py 
b/Lib/test/test_external_inspection.py
index 957c4b91acbfcd..eea796d74a7974 100644
--- a/Lib/test/test_external_inspection.py
+++ b/Lib/test/test_external_inspection.py
@@ -73,14 +73,15 @@ def test_long_task_name_is_truncated(self):
         async def main():
             asyncio.create_task(asyncio.sleep(10_000), name="x" * 300)
             await asyncio.sleep(0)
-            return [
+            names = [
                 task.task_name
                 for info in RemoteUnwinder(os.getpid()).get_all_awaited_by()
                 for task in info.awaited_by
             ]
+            return asyncio.current_task().get_name(), names
 
-        names = asyncio.run(main())
-        self.assertIn("Task-1", names)
+        main_name, names = asyncio.run(main())
+        self.assertIn(main_name, names)
         self.assertEqual([len(n) for n in names if n.startswith("x")], [255])
 
     @skip_if_not_supported

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to