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


Python tests.reap_children函数代码示例

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


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

示例1: test_reap_children

 def test_reap_children(self):
     subp = get_test_subprocess()
     p = psutil.Process(subp.pid)
     assert p.is_running()
     reap_children()
     assert not p.is_running()
     assert not psutil.tests._pids_started
     assert not psutil.tests._subprocesses_started
开发者ID:jomann09,项目名称:psutil,代码行数:8,代码来源:test_misc.py

示例2: tearDown

 def tearDown(self):
     safe_rmpath(TESTFN)
     reap_children()
     if not NETBSD:
         # Make sure we closed all resources.
         # NetBSD opens a UNIX socket to /var/log/run.
         cons = thisproc.connections(kind='all')
         assert not cons, cons
开发者ID:giampaolo,项目名称:psutil,代码行数:8,代码来源:test_connections.py

示例3: subprocess_supports_unicode

def subprocess_supports_unicode(name):
    """Return True if both the fs and the subprocess module can
    deal with a unicode file name.
    """
    if PY3:
        return True
    try:
        safe_rmpath(name)
        create_exe(name)
        get_test_subprocess(cmd=[name])
    except UnicodeEncodeError:
        return False
    else:
        reap_children()
        return True
开发者ID:marcinkuzminski,项目名称:psutil,代码行数:15,代码来源:test_unicode.py

示例4: test_pid_exists_2

 def test_pid_exists_2(self):
     reap_children()
     pids = psutil.pids()
     for pid in pids:
         try:
             assert psutil.pid_exists(pid)
         except AssertionError:
             # in case the process disappeared in meantime fail only
             # if it is no longer in psutil.pids()
             time.sleep(.1)
             if pid in psutil.pids():
                 self.fail(pid)
     pids = range(max(pids) + 5000, max(pids) + 6000)
     for pid in pids:
         self.assertFalse(psutil.pid_exists(pid), msg=pid)
开发者ID:mabuaita,项目名称:ops,代码行数:15,代码来源:test_system.py

示例5: test_create_proc_children_pair

    def test_create_proc_children_pair(self):
        p1, p2 = create_proc_children_pair()
        self.assertNotEqual(p1.pid, p2.pid)
        assert p1.is_running()
        assert p2.is_running()
        children = psutil.Process().children(recursive=True)
        self.assertEqual(len(children), 2)
        self.assertIn(p1, children)
        self.assertIn(p2, children)
        self.assertEqual(p1.ppid(), os.getpid())
        self.assertEqual(p2.ppid(), p1.pid)

        # make sure both of them are cleaned up
        reap_children()
        assert not p1.is_running()
        assert not p2.is_running()
        assert not psutil.tests._pids_started
        assert not psutil.tests._subprocesses_started
开发者ID:jomann09,项目名称:psutil,代码行数:18,代码来源:test_misc.py

示例6: tearDownClass

 def tearDownClass(cls):
     reap_children()
开发者ID:eomsoft,项目名称:teleport,代码行数:2,代码来源:test_osx.py

示例7: tearDown

 def tearDown(self):
     reap_children()
     safe_rmpath(self.funky_name)
开发者ID:marcinkuzminski,项目名称:psutil,代码行数:3,代码来源:test_unicode.py

示例8: tearDown

 def tearDown(self):
     reap_children()
开发者ID:4sp1r3,项目名称:psutil,代码行数:2,代码来源:test_memory_leaks.py

示例9: tearDownClass

 def tearDownClass(cls):
     super(TestTerminatedProcessLeaks, cls).tearDownClass()
     reap_children()
开发者ID:tijko,项目名称:psutil,代码行数:3,代码来源:test_memory_leaks.py

示例10: tearDown

 def tearDown(self):
     self.proc32.communicate()
     self.proc64.communicate()
     reap_children()
开发者ID:4sp1r3,项目名称:psutil,代码行数:4,代码来源:test_windows.py

示例11: tearDownClass

 def tearDownClass(cls):
     reap_children()
     safe_rmpath(cls.funky_name)
开发者ID:giampaolo,项目名称:psutil,代码行数:3,代码来源:test_unicode.py

示例12: test_reap_children

 def test_reap_children(self):
     subp = get_test_subprocess()
     assert psutil.pid_exists(subp.pid)
     reap_children()
     assert not psutil.pid_exists(subp.pid)
开发者ID:alfonsjose,项目名称:international-orders-app,代码行数:5,代码来源:test_testutils.py


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