本文整理汇总了Python中gstswitch.controller.Controller.get_preview_ports方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.get_preview_ports方法的具体用法?Python Controller.get_preview_ports怎么用?Python Controller.get_preview_ports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gstswitch.controller.Controller
的用法示例。
在下文中一共展示了Controller.get_preview_ports方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_preview_ports
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import get_preview_ports [as 别名]
def get_preview_ports(num):
"""Get Preview Ports when num number of sources are added"""
video_port = 3000
serv = Server(path=PATH, video_port=video_port)
try:
serv.run()
sources = TestSources(video_port=video_port)
expected_res = [ i for i in range(3003, 3003 + num)]
controller = Controller()
res = []
for _ in range(num):
sources.new_test_video()
controller.establish_connection()
res = controller.get_preview_ports()
print res
assert expected_res == res
finally:
if serv.proc:
poll = serv.proc.poll()
if poll == -11:
print "SEGMENTATION FAULT OCCURRED"
print "ERROR CODE - {0}".format(poll)
serv.terminate(1)
log = open('server.log')
print log.read()
示例2: get_preview_ports
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import get_preview_ports [as 别名]
def get_preview_ports(self):
"""Create Controller object and call get_preview_ports method"""
res = []
controller = Controller()
controller.establish_connection()
for _ in range(self.NUM * self.FACTOR):
res.append(controller.get_preview_ports())
return res
示例3: test_normal_unpack
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import get_preview_ports [as 别名]
def test_normal_unpack(self):
"""Test if valid"""
controller = Controller(address='unix:abstract=abcdef')
controller.connection = MockConnection(False)
controller.parse_preview_ports = Mock(return_value=[3001, 3002])
assert controller.get_preview_ports() == [3001, 3002]
示例4: test_unpack
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import get_preview_ports [as 别名]
def test_unpack(self):
"""Test if unpack fails"""
controller = Controller(address='unix:abstract=abcdefghijk')
controller.connection = MockConnection(True)
with pytest.raises(ConnectionReturnError):
controller.get_preview_ports()
示例5: do_get_preview_ports
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import get_preview_ports [as 别名]
def do_get_preview_ports(self, line):
c = Controller()
c.establish_connection()
print c.get_preview_ports()