当前位置: 首页>>代码示例>>Python>>正文


Python interfaces.IReactorProcess方法代码示例

本文整理汇总了Python中twisted.internet.interfaces.IReactorProcess方法的典型用法代码示例。如果您正苦于以下问题:Python interfaces.IReactorProcess方法的具体用法?Python interfaces.IReactorProcess怎么用?Python interfaces.IReactorProcess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.internet.interfaces的用法示例。


在下文中一共展示了interfaces.IReactorProcess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_echo

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorProcess [as 别名]
def test_echo(self):
        """
        A spawning a subprocess which echoes its stdin to its stdout via
        L{IReactorProcess.spawnProcess} will result in that echoed output being
        delivered to outReceived.
        """
        finished = defer.Deferred()
        p = EchoProtocol(finished)

        scriptPath = b"twisted.test.process_echoer"
        reactor.spawnProcess(p, pyExe, [pyExe, b'-u', b"-m", scriptPath],
                             env=properEnv)

        def asserts(ignored):
            self.assertFalse(p.failure, p.failure)
            self.assertTrue(hasattr(p, 'buffer'))
            self.assertEqual(len(p.buffer), len(p.s * p.n))

        def takedownProcess(err):
            p.transport.closeStdin()
            return err

        return finished.addCallback(asserts).addErrback(takedownProcess) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:25,代码来源:test_process.py

示例2: spawnProcess

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorProcess [as 别名]
def spawnProcess(self, worker, *args, **kwargs):
        """
        See L{IReactorProcess.spawnProcess}.

        @param worker: See L{IReactorProcess.spawnProcess}.
        @param args: See L{IReactorProcess.spawnProcess}.
        @param kwargs: See L{IReactorProcess.spawnProcess}.
        """
        self._workers.append(worker)
        worker.makeConnection(FakeTransport())
        self.spawnCount += 1 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:13,代码来源:test_disttrial.py

示例3: test_providesIReactorProcess

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IReactorProcess [as 别名]
def test_providesIReactorProcess(self):
        """
        L{CountingReactor} instances provide L{IReactorProcess}.
        """
        verify.verifyObject(interfaces.IReactorProcess, self.reactor) 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:7,代码来源:test_disttrial.py


注:本文中的twisted.internet.interfaces.IReactorProcess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。