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


Python Server.proc方法代码示例

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


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

示例1: test_kill

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_kill(self, monkeypatch):
     """Test kill ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = Mock()
     monkeypatch.setattr(os, 'kill', Mock(side_effect=OSError))
     with pytest.raises(ServerProcessError):
         serv.kill()
开发者ID:mithro,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例2: test_kill_fail

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_kill_fail(self):
     """Test when kill fails"""
     serv = Server(path=PATH)
     serv.proc = 1
     serv.pid = -300
     with pytest.raises(ServerProcessError):
         serv.kill()
开发者ID:mithro,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例3: test_gcov_flush_fail

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_gcov_flush_fail(self):
     """Test when gcov_flush fails"""
     serv = Server(path=PATH)
     serv.proc = 1
     serv.pid = -300
     with pytest.raises(ServerProcessError):
         serv.gcov_flush()
开发者ID:mithro,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例4: test_normal_gcov_flush

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_normal_gcov_flush(self, monkeypatch):
     """Test gcov_flush"""
     serv = Server(path='abc')
     serv.proc = Mock()
     monkeypatch.setattr(os, 'kill', Mock())
     res = serv.gcov_flush()
     assert res is True
     assert serv.proc is not None
开发者ID:mithro,项目名称:gst-switch,代码行数:10,代码来源:test_server_unit.py

示例5: test_terminate_cov

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_terminate_cov(self):
     """Test terminate and gcov_flush ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = MockProcess(False)
     serv.gcov_flush = Mock()
     serv.make_coverage = Mock()
     with pytest.raises(ServerProcessError):
         serv.terminate(True)
开发者ID:mithro,项目名称:gst-switch,代码行数:10,代码来源:test_server_unit.py

示例6: test_normal_kill

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_normal_kill(self, monkeypatch):
     """Test kill when normally called"""
     serv = Server(path='abc')
     serv.proc = Mock()
     monkeypatch.setattr(os, 'kill', Mock())
     res = serv.kill()
     assert res is True
     assert serv.proc is None
开发者ID:mithro,项目名称:gst-switch,代码行数:10,代码来源:test_server_unit.py

示例7: test_gov_flush_fail

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
    def test_gov_flush_fail(self):
        """Test when gov_flush fails"""
        serv = Server(path=PATH)
        serv.proc = Mock(ProcessMonitor)
        serv.proc.send_signal.side_effect = OSError

        with pytest.raises(ServerProcessError):
            serv.gcov_flush()
开发者ID:a740122,项目名称:gst-switch,代码行数:10,代码来源:test_server_unit.py

示例8: test_kill_cov

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_kill_cov(self, monkeypatch):
     """Test kill and gcov_flush ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = MockProcess(False)
     serv.gcov_flush = Mock()
     serv.make_coverage = Mock()
     monkeypatch.setattr(os, 'kill', Mock(side_effect=OSError))
     with pytest.raises(ServerProcessError):
         serv.kill(True)
开发者ID:mithro,项目名称:gst-switch,代码行数:11,代码来源:test_server_unit.py

示例9: test_is_not_alive

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
    def test_is_not_alive(self, monkeypatch):
        """ Test that is_alive returns True when the
            underlying proc returns None on Poll
        """
        serv = Server()
        serv.proc = Mock()
        monkeypatch.setattr(serv.proc, "poll", Mock(return_value=123))

        assert serv.is_alive() is False
开发者ID:a740122,项目名称:gst-switch,代码行数:11,代码来源:test_server_unit.py

示例10: test_error_is_passed

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
    def test_error_is_passed(self, monkeypatch):
        """ Test that wait_for_output passes all
            Exceptions from the underlying ProcessMonitor
        """
        serv = Server()
        serv.proc = Mock()
        monkeypatch.setattr(serv.proc, "wait_for_output", Mock(side_effect=MatchTimeoutError))

        with pytest.raises(MatchTimeoutError):
            serv.wait_for_output("foo", timeout=123, count=456)
开发者ID:a740122,项目名称:gst-switch,代码行数:12,代码来源:test_server_unit.py

示例11: test_args_are_passed

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
    def test_args_are_passed(self, monkeypatch):
        """ Test that wait_for_output passes all
            Arguments to the underlying ProcessMonitor
        """
        serv = Server()
        serv.proc = Mock()
        monkeypatch.setattr(serv.proc, "wait_for_output", Mock())

        serv.wait_for_output("foo", timeout=123, count=456)
        serv.proc.wait_for_output.called_once_with("foo", timeout=123, count=456)
开发者ID:a740122,项目名称:gst-switch,代码行数:12,代码来源:test_server_unit.py

示例12: test_terminate_fail

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
    def test_terminate_fail(self):
        """Test when terminate fails"""
        class FakeProc(object):

            """A mock process"""

            def __init__(self):
                pass

            def terminate(self):
                """Terminate the mock process"""
                raise OSError

        serv = Server(path=PATH)
        serv.proc = FakeProc()
        with pytest.raises(ServerProcessError):
            serv.terminate()
开发者ID:mithro,项目名称:gst-switch,代码行数:19,代码来源:test_server_unit.py

示例13: test_terminate

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_terminate(self):
     """Test terminate ServerProcessError"""
     serv = Server(path='abc')
     serv.proc = MockProcess(False)
     with pytest.raises(ServerProcessError):
         serv.terminate()
开发者ID:mithro,项目名称:gst-switch,代码行数:8,代码来源:test_server_unit.py

示例14: test_normal_terminate

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import proc [as 别名]
 def test_normal_terminate(self):
     """Test terminal when normally called"""
     serv = Server(path='abc')
     serv.proc = MockProcess(True)
     serv.terminate()
     assert serv.proc is None
开发者ID:mithro,项目名称:gst-switch,代码行数:8,代码来源:test_server_unit.py


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