(self)
| 4195 | |
| 4196 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 4197 | def test_pickling(self): |
| 4198 | families = self.connection.families |
| 4199 | |
| 4200 | lconn, lconn0 = self.Pipe() |
| 4201 | lp = self.Process(target=self._listener, args=(lconn0, families)) |
| 4202 | lp.daemon = True |
| 4203 | lp.start() |
| 4204 | lconn0.close() |
| 4205 | |
| 4206 | rconn, rconn0 = self.Pipe() |
| 4207 | rp = self.Process(target=self._remote, args=(rconn0,)) |
| 4208 | rp.daemon = True |
| 4209 | rp.start() |
| 4210 | rconn0.close() |
| 4211 | |
| 4212 | for fam in families: |
| 4213 | msg = ('This connection uses family %s' % fam).encode('ascii') |
| 4214 | address = lconn.recv() |
| 4215 | rconn.send((address, msg)) |
| 4216 | new_conn = lconn.recv() |
| 4217 | self.assertEqual(new_conn.recv(), msg.upper()) |
| 4218 | |
| 4219 | rconn.send(None) |
| 4220 | |
| 4221 | msg = latin('This connection uses a normal socket') |
| 4222 | address = lconn.recv() |
| 4223 | rconn.send((address, msg)) |
| 4224 | new_conn = lconn.recv() |
| 4225 | buf = [] |
| 4226 | while True: |
| 4227 | s = new_conn.recv(100) |
| 4228 | if not s: |
| 4229 | break |
| 4230 | buf.append(s) |
| 4231 | buf = b''.join(buf) |
| 4232 | self.assertEqual(buf, msg.upper()) |
| 4233 | new_conn.close() |
| 4234 | |
| 4235 | lconn.send(None) |
| 4236 | |
| 4237 | rconn.close() |
| 4238 | lconn.close() |
| 4239 | |
| 4240 | lp.join() |
| 4241 | rp.join() |
| 4242 | |
| 4243 | @classmethod |
| 4244 | def child_access(cls, conn): |
nothing calls this directly
no test coverage detected