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


Python test_support.reap_children函数代码示例

本文整理汇总了Python中test.test_support.reap_children函数的典型用法代码示例。如果您正苦于以下问题:Python reap_children函数的具体用法?Python reap_children怎么用?Python reap_children使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test

def test():
    import sys
    if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'):
        if verbose:
            print "Can't test select easily on", sys.platform
        return
    cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done'
    p = os.popen(cmd, 'r')
    for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10:
        if verbose:
            print 'timeout =', tout
        rfd, wfd, xfd = select.select([p], [], [], tout)
        if (rfd, wfd, xfd) == ([], [], []):
            continue
        if (rfd, wfd, xfd) == ([p], [], []):
            line = p.readline()
            if verbose:
                print repr(line)
            if not line:
                if verbose:
                    print 'EOF'
                break
            continue
        print 'Unexpected return values from select():', rfd, wfd, xfd
    p.close()
    reap_children()
开发者ID:005,项目名称:gevent,代码行数:26,代码来源:test_select.py

示例2: test

def test():
    import sys

    if sys.platform[:3] in ("win", "mac", "os2", "riscos"):
        if verbose:
            print "Can't test select easily on", sys.platform
        return
    cmd = "for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done"
    p = os.popen(cmd, "r")
    for tout in (0, 1, 2, 4, 8, 16) + (None,) * 10:
        if verbose:
            print "timeout =", tout
        rfd, wfd, xfd = select.select([p], [], [], tout)
        if (rfd, wfd, xfd) == ([], [], []):
            continue
        if (rfd, wfd, xfd) == ([p], [], []):
            line = p.readline()
            if verbose:
                print repr(line)
            if not line:
                if verbose:
                    print "EOF"
                break
            continue
        print "Unexpected return values from select():", rfd, wfd, xfd
    p.close()
    reap_children()
开发者ID:B-Rich,项目名称:breve,代码行数:27,代码来源:test_select.py

示例3: test_main

def test_main():
    try:
        test.test_support.run_unittest(PyDocDocTest,
                                       PydocImportTest,
                                       TestDescriptions,
                                       TestHelper)
    finally:
        reap_children()
开发者ID:49476291,项目名称:android-plus-plus,代码行数:8,代码来源:test_pydoc.py

示例4: test_main

def test_main():
    test_support.run_unittest(
        BZ2FileTest,
        BZ2CompressorTest,
        BZ2DecompressorTest,
        FuncTest
    )
    test_support.reap_children()
开发者ID:Alkalit,项目名称:pypyjs,代码行数:8,代码来源:test_bz2.py

示例5: test_main

def test_main():
    unit_tests = (ProcessTestCase,
                  POSIXProcessTestCase,
                  Win32ProcessTestCase,
                  ProcessTestCaseNoPoll,
                  HelperFunctionTests)

    test_support.run_unittest(*unit_tests)
    test_support.reap_children()
开发者ID:89sos98,项目名称:main,代码行数:9,代码来源:test_subprocess.py

示例6: tearDown

    def tearDown (self):
        signal_alarm(0)  # Didn't deadlock.
        reap_children()

        for fn in self.test_files:
            try:
                os.remove(fn)
            except os.error:
                pass
        self.test_files[:] = []
开发者ID:inercia,项目名称:evy,代码行数:10,代码来源:test_full_socketserver.py

示例7: test_main

def test_main():
    try:
        start_dir = os.path.dirname(__file__)
        top_dir = os.path.dirname(os.path.dirname(start_dir))
        test_loader = unittest.TestLoader()
        # XXX find out how to use unittest.main, to get command-line options
        # (failfast, catch, etc.)
        run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir))
    finally:
        reap_children()
开发者ID:dstufft,项目名称:distutils2,代码行数:10,代码来源:__main__.py

示例8: test_main

def test_main():
    import imp
    if imp.lock_held():
        # If the import lock is held, the threads will hang.
        raise TestSkipped("can't run when import lock is held")

    try:
        testall()
    finally:
        cleanup()
    reap_children()
开发者ID:005,项目名称:gevent,代码行数:11,代码来源:test_socketserver.py

示例9: run_pydoc

def run_pydoc(module_name, *args):
    """
    Runs pydoc on the specified module. Returns the stripped
    output of pydoc.
    """
    cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name]
    try:
        output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
        return output.strip()
    finally:
        reap_children()
开发者ID:AbnerChang,项目名称:edk2-staging,代码行数:11,代码来源:test_pydoc.py

示例10: tearDown

 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "popen2._active not empty")
     # The os.popen*() API delegates to the subprocess module (on Unix)
     import subprocess
     for inst in subprocess._active:
         inst.wait()
     subprocess._cleanup()
     self.assertFalse(subprocess._active, "subprocess._active not empty")
     reap_children()
开发者ID:clamxyz,项目名称:LearnPythonTheHardWay,代码行数:12,代码来源:test_popen2.py

示例11: test_main

def test_main(verbose=None):
    cwd = os.getcwd()
    env = os.environ.copy()
    try:
        test_support.run_unittest(BaseHTTPServerTestCase,
                                  SimpleHTTPServerTestCase,
                                  CGIHTTPServerTestCase
                                  )
    finally:
        test_support.reap_children()
        os.environ.clear()
        os.environ.update(env)
        os.chdir(cwd)
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:13,代码来源:test_httpservers.py

示例12: test_main

def test_main():
    try:
        test_support.run_unittest(ProcessPoolExecutorTest,
                                  ThreadPoolExecutorTest,
                                  ProcessPoolWaitTests,
                                  ThreadPoolWaitTests,
                                  ProcessPoolAsCompletedTests,
                                  ThreadPoolAsCompletedTests,
                                  FutureTests,
                                  ProcessPoolShutdownTest,
                                  ThreadPoolShutdownTest)
    finally:
        test_support.reap_children()
开发者ID:wujuguang,项目名称:pythonfutures,代码行数:13,代码来源:test_futures.py

示例13: tearDown

 def tearDown(self):
     for inst in popen2._active:
         inst.wait()
     popen2._cleanup()
     self.assertFalse(popen2._active, "popen2._active not empty")
     # The os.popen*() API delegates to the subprocess module (on Unix)
     if not due_to_ironpython_bug("http://ironpython.codeplex.com/workitem/15512"):
         import subprocess
         for inst in subprocess._active:
             inst.wait()
         subprocess._cleanup()
         self.assertFalse(subprocess._active, "subprocess._active not empty")
     reap_children()
开发者ID:BillyboyD,项目名称:main,代码行数:13,代码来源:test_popen2.py

示例14: test_popen

 def test_popen(self):
     self.assertRaises(TypeError, os.popen)
     self._do_test_commandline(
         "foo bar",
         ["foo", "bar"]
     )
     self._do_test_commandline(
         'foo "spam and eggs" "silly walk"',
         ["foo", "spam and eggs", "silly walk"]
     )
     self._do_test_commandline(
         'foo "a \\"quoted\\" arg" bar',
         ["foo", 'a "quoted" arg', "bar"]
     )
     test_support.reap_children()
开发者ID:sephamorr,项目名称:8650linux,代码行数:15,代码来源:test_popen.py

示例15: sloppy_cleanup

def sloppy_cleanup():
    # See http://python.org/sf/1540386
    # We need to reap children here otherwise a child from one server
    # can be left running for the next server and cause a test failure.
    time.sleep(DELAY)
    reap_children()
开发者ID:005,项目名称:gevent,代码行数:6,代码来源:test_socketserver.py


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