(self)
| 915 | self.assertEqual(received, obj) |
| 916 | |
| 917 | def test_send_timeout(self): |
| 918 | obj = b'spam' |
| 919 | |
| 920 | with self.subTest('non-blocking with timeout'): |
| 921 | cid = _channels.create(REPLACE) |
| 922 | with self.assertRaises(ValueError): |
| 923 | _channels.send(cid, obj, blocking=False, timeout=0.1) |
| 924 | |
| 925 | with self.subTest('timeout hit'): |
| 926 | cid = _channels.create(REPLACE) |
| 927 | with self.assertRaises(TimeoutError): |
| 928 | _channels.send(cid, obj, blocking=True, timeout=0.1) |
| 929 | with self.assertRaises(_channels.ChannelEmptyError): |
| 930 | received = recv_nowait(cid) |
| 931 | print(repr(received)) |
| 932 | |
| 933 | with self.subTest('timeout not hit'): |
| 934 | cid = _channels.create(REPLACE) |
| 935 | def f(): |
| 936 | recv_wait(cid) |
| 937 | t = threading.Thread(target=f) |
| 938 | t.start() |
| 939 | _channels.send(cid, obj, blocking=True, timeout=10) |
| 940 | t.join() |
| 941 | |
| 942 | def test_send_buffer_timeout(self): |
| 943 | try: |
nothing calls this directly
no test coverage detected