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


Python Server._start_process方法代码示例

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


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

示例1: test_raises_enoent

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_raises_enoent(self):
     """Test what happens when ProcessMonitor raises an OSError ENOENT"""
     with patch("gstswitch.server.ProcessMonitor") as mock:
         mock.side_effect = OSError(ENOENT, "not found")
         serv = Server(path="abc")
         with pytest.raises(PathError):
             serv._start_process("cmd")
开发者ID:a740122,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例2: test_raises_oserror

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_raises_oserror(self):
     """Test what happens when ProcessMonitor raises an OSError"""
     with patch("gstswitch.server.ProcessMonitor") as mock:
         mock.side_effect = OSError()
         serv = Server(path="abc")
         with pytest.raises(ServerProcessError):
             serv._start_process("cmd")
开发者ID:a740122,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例3: test_log_to_stderr

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_log_to_stderr(self):
     """Test log_to_file=False property"""
     with patch("gstswitch.server.ProcessMonitor") as mock:
         serv = Server(path="abc")
         serv.log_to_file = False
         serv._start_process("cmd")
         mock.assert_called_with("cmd")
开发者ID:a740122,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例4: test_start_process_error

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_start_process_error(self, monkeypatch):
     """Test _start_process method"""
     with patch("subprocess.Popen.__init__") as mock:
         mock.side_effect = OSError
         serv = Server(path="abc")
         with pytest.raises(ServerProcessError):
             serv._start_process("def")
开发者ID:a740122,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例5: test_start_process_normal

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_start_process_normal(self, monkeypatch):
     """Test _start_process normally"""
     serv = Server(path='abc')
     monkeypatch.setattr(
         subprocess,
         'Popen',
         Mock(return_value=MockProcess()))
     serv._start_process('cmd')
开发者ID:mithro,项目名称:gst-switch,代码行数:10,代码来源:test_server_unit.py

示例6: test_log_to_file

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_log_to_file(self):
     """Test log_to_file=True property"""
     with patch("gstswitch.server.open", create=True) as mock_open:
         mock_open.return_value = 123
         with patch("gstswitch.server.ProcessMonitor") as mock:
             serv = Server(path="abc")
             serv.log_to_file = True
             serv._start_process("cmd")
             mock.assert_called_with("cmd", 123)
开发者ID:a740122,项目名称:gst-switch,代码行数:11,代码来源:test_server_unit.py

示例7: test_run_process

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_run_process(self):
     """Test _run_process method"""
     serv = Server(path='abc')
     serv._start_process = Mock(return_value=MockProcess())
     serv.gst_option_string = ''
     ret = serv._run_process()
     assert ret is not None
开发者ID:mithro,项目名称:gst-switch,代码行数:9,代码来源:test_server_unit.py

示例8: test_video_format

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_video_format(self):
     """Test video_format property"""
     serv = Server(path="abc")
     serv._start_process = Mock()
     serv.video_format = "ZZZ"
     serv._run_process()
     serv._start_process.assert_called_once()
     assert "--video-format=ZZZ" in serv._start_process.call_args[0][0]
开发者ID:a740122,项目名称:gst-switch,代码行数:10,代码来源:test_server_unit.py

示例9: test_option_string

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
 def test_option_string(self):
     """Test option_string property"""
     serv = Server(path="abc")
     serv._start_process = Mock()
     serv.gst_option_string = "-ZZZ"
     serv._run_process()
     serv._start_process.assert_called_once()
     assert "-ZZZ" in serv._start_process.call_args[0][0]
开发者ID:a740122,项目名称:gst-switch,代码行数:10,代码来源:test_server_unit.py

示例10: test_record_file_valid_space

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
    def test_record_file_valid_space(self):
        """Test if record file is valid and has a space"""
        def mock_method(arg):
            """Mocking _start_process"""
            return arg
        path = '/usr'
        serv = Server(path=path, record_file='record 1.data')
        serv._start_process = mock_method
        assert serv._run_process() == "/usr/gst-switch-srv \
--video-input-port=3000 --audio-input-port=4000 \
--control-port=5000".split() + ["--record=record 1.data"]
开发者ID:hyades,项目名称:gst-switch,代码行数:13,代码来源:test_server_unit.py

示例11: test_record_file_valid

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
    def test_record_file_valid(self):
        """Test if record file is valid"""
        def mock_method(arg):
            """Mocking _start_process"""
            return arg
        path = '/usr'
        serv = Server(path=path, record_file="record.data")
        serv._start_process = mock_method
        assert serv._run_process() == "/usr/gst-switch-srv \
--video-input-port=3000 --audio-input-port=4000 \
--controller-address=tcp:host=0.0.0.0,port=5000 --record=record.data".split()
开发者ID:mithro,项目名称:gst-switch,代码行数:13,代码来源:test_server_unit.py

示例12: test_record_file_true

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
    def test_record_file_true(self):
        """Test if record file is True"""
        def mock_method(arg):
            """Mocking _start_process"""
            return arg
        path = '/usr'
        serv = Server(path=path, record_file=True)
        serv._start_process = mock_method
        assert serv._run_process() == "/usr/gst-switch-srv \
--video-input-port=3000 --audio-input-port=4000 \
--control-port=5000 -r".split()
开发者ID:hyades,项目名称:gst-switch,代码行数:13,代码来源:test_server_unit.py

示例13: test_path_provided_no_slash

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
    def test_path_provided_no_slash(self):
        """Test if a path is provided"""
        def mock_method(arg):
            """Mocking _start_process"""
            return arg
        path = '/usr'
        serv = Server(path=path)
        serv._start_process = mock_method
        assert serv._run_process() == "/usr/gst-switch-srv \
--video-input-port=3000 --audio-input-port=4000 \
--controller-address=tcp:host=0.0.0.0,port=5000".split()
开发者ID:mithro,项目名称:gst-switch,代码行数:13,代码来源:test_server_unit.py

示例14: test_record_file_false

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
    def test_record_file_false(self):
        """Test if record file is False"""

        def mock_method(arg):
            """Mocking _start_process"""
            return arg

        path = "/usr"
        serv = Server(path=path, record_file=False)
        serv._start_process = mock_method
        assert (
            serv._run_process()
            == "/usr/gst-switch-srv \
--video-input-port=3000 --audio-input-port=4000 \
--controller-address=tcp:host=::,port=5000".split()
        )
开发者ID:a740122,项目名称:gst-switch,代码行数:18,代码来源:test_server_unit.py

示例15: test_path_empty

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _start_process [as 别名]
    def test_path_empty(self, monkeypatch):
        """Test if null path is given"""

        def mock_method(arg):
            "Mocking _start_process"
            return arg

        def mockreturn(path):
            "Mocking distutils.spawn.find_executable"
            return '/usr/gst-switch-srv'
        monkeypatch.setattr(spawn, 'find_executable', mockreturn)
        paths = [None, '']
        for path in paths:
            serv = Server(path=path)
            serv._start_process = mock_method
            assert serv._run_process() == "/usr/gst-switch-srv \
--video-input-port=3000 --audio-input-port=4000 \
--controller-address=tcp:host=0.0.0.0,port=5000".split()
开发者ID:mithro,项目名称:gst-switch,代码行数:20,代码来源:test_server_unit.py


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