MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_select

Method test_select

Lib/test/test_select.py:52–80  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

reprFunction · 0.85
dedentMethod · 0.80
printFunction · 0.50
selectMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected