def setUp(self): self.loop = test_utils.TestLoop() self.protocol = test_utils.make_test_protocol(protocols.Protocol) self.pipe = unittest.mock.Mock(spec_set=io.RawIOBase) self.pipe.fileno.return_value = 5 fcntl_patcher = unittest.mock.patch('fcntl.fcntl') fcntl_patcher.start() self.addCleanup(fcntl_patcher.stop)
def setUp(self): self.loop = test_utils.TestLoop() self.protocol = test_utils.make_test_protocol(protocols.BaseProtocol) self.pipe = unittest.mock.Mock(spec_set=io.RawIOBase) self.pipe.fileno.return_value = 5 fcntl_patcher = unittest.mock.patch('fcntl.fcntl') fcntl_patcher.start() self.addCleanup(fcntl_patcher.stop) fstat_patcher = unittest.mock.patch('os.fstat') m_fstat = fstat_patcher.start() st = unittest.mock.Mock() st.st_mode = stat.S_IFIFO m_fstat.return_value = st self.addCleanup(fstat_patcher.stop)
def setUp(self): self.loop = test_utils.TestLoop() self.proactor = unittest.mock.Mock() self.loop._proactor = self.proactor self.protocol = test_utils.make_test_protocol(tulip.Protocol) self.sock = unittest.mock.Mock(socket.socket)