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


Python Server.kill方法代码示例

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


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

示例1: test_kill_fail

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [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

示例2: test_kill

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [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

示例3: main

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [as 别名]
def main(args):

    print("running server")
    serv = Server(path=args.path)
    serv.run()

    wait(5)

    print("running source pattern=1")
    sources = TestSources(video_port=3000, audio_port=4000)
    sources.new_test_video(pattern=1)

    wait(5)

    print("running gst-switch-ui")
    # the & will run this in the background so control returns 
    # and we can bring up the 2nd source 

    # Replaced call with subprocess.Popen. 
    SwitchUi = subprocess.Popen("gst-switch-ui &",shell=True)

    wait(5)
       
    print("running source pattern=18")
    sources.new_test_video(pattern=18)

    raw_input("hit enter:")


    # Replaced pkill call with Popen.kill
    subprocess.Popen.kill(SwitchUi)
    serv.kill()
开发者ID:KKcorps,项目名称:Gst-Files,代码行数:34,代码来源:run-demo.py

示例4: test_kill_cov

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [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

示例5: test_video_sources

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [as 别名]
 def test_video_sources(self):
     """Test video sources"""
     video_port = 3000
     serv = Server(PATH, video_port=video_port)
     try:
         serv.run()
         preview = PreviewSinks()
         preview.run()
         for i in range(self.NUM):
             self.add_video_sources(i * 10 + 1, video_port)
         preview.terminate()
         serv.terminate()
     finally:
         if serv.proc:
             serv.kill()
开发者ID:mithro,项目名称:gst-switch,代码行数:17,代码来源:test_helpers.py

示例6: test_audio_sources

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [as 别名]
    def test_audio_sources(self):
        """Test audio sources"""
        audio_port = 4000
        serv = Server(PATH, audio_port=audio_port)
        try:
            serv.run()
            preview = PreviewSinks()
            preview.run()
            for i in range(self.NUM):
                self.add_audio_sources(i * 10 + 1, audio_port)

            preview.terminate()
            serv.terminate()
        finally:
            if serv.proc:
                serv.kill()
开发者ID:mithro,项目名称:gst-switch,代码行数:18,代码来源:test_helpers.py

示例7: test_normal_kill

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [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

示例8: open

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [as 别名]
                        cmd.split(),
                        stdout=tempf,
                        stderr=tempf,
                        bufsize=-1,
                        shell=False)

    params = [(65,3004), (65, 3003)]
    i = 0
    p = psutil.Process(s.pid)
    cpu_usage_file = open("cpu.log", "w")
    while 1:
        # print(i)
        cpu = p.get_cpu_percent(interval=INTERVAL)
        mem = p.get_memory_percent()
        print(cpu)
        print(mem)
        cpu_usage_file.write(str(cpu) + '\n' + str(mem) + '\n')
        controller.switch(params[i][0], params[i][1])
        # time.sleep(1)
        i+=1
        i%=2

    #end all
    sources.terminate_audio()
    vid1.terminate()
    vid2.terminate()
    s.terminate()
finally:
    if s.proc:
        s.kill()
开发者ID:mithro,项目名称:gst-switch,代码行数:32,代码来源:switch_infinite_test.py

示例9: test_no_process_kill

# 需要导入模块: from gstswitch.server import Server [as 别名]
# 或者: from gstswitch.server.Server import kill [as 别名]
 def test_no_process_kill(self):
     """Test when no process exists and kill is called"""
     serv = Server(path=PATH)
     with pytest.raises(ServerProcessError):
         serv.kill()
开发者ID:mithro,项目名称:gst-switch,代码行数:7,代码来源:test_server_unit.py


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