https://github.com/python/cpython/commit/6eedb1a05769bdcbdad350a56aea9c2132426b77
commit: 6eedb1a05769bdcbdad350a56aea9c2132426b77
branch: main
author: Hugo van Kemenade <[email protected]>
committer: hugovk <[email protected]>
date: 2026-09-22T13:28:13+03:00
summary:

gh-157788: Fix `test_long_task_name_is_truncated` by not hardcoding main task 
name (#157911)

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 1fed0f9175e8e1..fd647153f92be6 100644
--- a/Lib/test/test_external_inspection.py
+++ b/Lib/test/test_external_inspection.py
@@ -447,14 +447,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