本文整理汇总了Python中gstswitch.server.Server._run_process方法的典型用法代码示例。如果您正苦于以下问题:Python Server._run_process方法的具体用法?Python Server._run_process怎么用?Python Server._run_process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gstswitch.server.Server
的用法示例。
在下文中一共展示了Server._run_process方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_binary_not_found
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_process [as 别名]
def test_binary_not_found(self, monkeypatch):
"""Test that a PathError os raised when
distutils.spawn.find_executable return nothing"""
monkeypatch.setattr(spawn, "find_executable", Mock(return_value=""))
with pytest.raises(PathError):
serv = Server()
serv._run_process()
示例2: test_video_format
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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]
示例3: test_option_string
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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]
示例4: test_run_process
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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
示例5: test_run
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_process [as 别名]
def test_run(self):
"""Test the run method"""
serv = Server(path='abc')
serv._run_process = Mock(return_value=MockProcess())
serv.run()
assert serv.pid == 1
assert serv.proc is not None
示例6: test_path_provided_no_slash
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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()
示例7: test_record_file_valid
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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()
示例8: test_record_file_valid_space
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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"]
示例9: test_record_file_true
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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()
示例10: test_record_file_false
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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()
)
示例11: test_path_empty
# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import _run_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()