[3.13] gh-121988: Fix test hang when pyrepl is not available (GH-121990) (#122064)

gh-121988: Fix test hang when pyrepl is not available (GH-121990)

Also explicitly fail the test if we timeout while waiting for output so
that this failure mode is caught earlier.
(cherry picked from commit a09e215abf3c80a3c99c86b4482b512b42aad072)

Co-authored-by: Sam Gross <colesbury@gmail.com>
1 file changed