Skip to content

Commit 42a0362

Browse files
committed
pythongh-108973: Fix asyncio test_subprocess_consistent_callbacks()
Subprocess events can be delivered in any order: tolerate that in the case.
1 parent c93c199 commit 42a0362

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def pipe_data_received(self, fd, data) -> None:
763763
events.append(('pipe_data_received', fd, data))
764764

765765
def pipe_connection_lost(self, fd, exc) -> None:
766-
events.append('pipe_connection_lost')
766+
events.append(('pipe_connection_lost', fd))
767767

768768
def process_exited(self) -> None:
769769
events.append('process_exited')
@@ -777,13 +777,16 @@ async def main() -> None:
777777
sys.executable, '-c', code, stdin=None)
778778
await exit_future
779779
transport.close()
780-
self.assertEqual(events, [
780+
781+
expected = [
781782
('pipe_data_received', 1, b'stdout'),
782783
('pipe_data_received', 2, b'stderr'),
783-
'pipe_connection_lost',
784-
'pipe_connection_lost',
784+
('pipe_connection_lost', 1),
785+
('pipe_connection_lost', 2),
785786
'process_exited',
786-
])
787+
]
788+
# gh-108973: Events can be delivered in any order
789+
self.assertSetEqual(set(events), set(expected))
787790

788791
self.loop.run_until_complete(main())
789792

0 commit comments

Comments
 (0)