(self)
| 49 | |
| 50 | @support.requires_fork() |
| 51 | def test_select(self): |
| 52 | code = textwrap.dedent(''' |
| 53 | import time |
| 54 | for i in range(10): |
| 55 | print("testing...", flush=True) |
| 56 | time.sleep(0.050) |
| 57 | ''') |
| 58 | cmd = [sys.executable, '-I', '-c', code] |
| 59 | with subprocess.Popen(cmd, stdout=subprocess.PIPE) as proc: |
| 60 | pipe = proc.stdout |
| 61 | for timeout in (0, 1, 2, 4, 8, 16) + (None,)*10: |
| 62 | if support.verbose: |
| 63 | print(f'timeout = {timeout}') |
| 64 | rfd, wfd, xfd = select.select([pipe], [], [], timeout) |
| 65 | self.assertEqual(wfd, []) |
| 66 | self.assertEqual(xfd, []) |
| 67 | if not rfd: |
| 68 | continue |
| 69 | if rfd == [pipe]: |
| 70 | line = pipe.readline() |
| 71 | if support.verbose: |
| 72 | print(repr(line)) |
| 73 | if not line: |
| 74 | if support.verbose: |
| 75 | print('EOF') |
| 76 | break |
| 77 | continue |
| 78 | self.fail('Unexpected return values from select():', |
| 79 | rfd, wfd, xfd) |
| 80 | |
| 81 | # Issue 16230: Crash on select resized list |
| 82 | @unittest.skipIf( |
nothing calls this directly
no test coverage detected