def test_normal(self): """Test if valid""" controller = Controller(address='unix:abstract=abcde') controller.establish_connection = Mock(return_value=None) controller.connection = MockConnection(True) face = [(1, 2, 3, 4), (1, 1, 1, 1)] controller.mark_face(face)
def mark_face(self, faces, index, generate_frames=False): """Create the Controller object and call mark_face method""" for _ in range(self.NUM): serv = Server(path=PATH, video_format="debug") try: serv.run() sources = TestSources(video_port=3000) preview = PreviewSinks() preview.run() out_file = "output-{0}.data".format(index) video_sink = VideoFileSink(3001, out_file) sources.new_test_video(pattern=4) sources.new_test_video(pattern=5) controller = Controller() time.sleep(1) res = controller.mark_face(faces) print(res) time.sleep(1) sources.terminate_video() preview.terminate() video_sink.terminate() serv.terminate(1) if not generate_frames: assert res is not None assert self.verify_output(index, out_file) is True finally: serv.terminate_and_output_status(cov=True)
def mark_face(self, faces, index, generate_frames=False): """Create the Controller object and call mark_face method""" for _ in range(self.NUM): serv = Server(path=PATH) try: serv.run() sources = TestSources(video_port=3000) preview = PreviewSinks() preview.run() out_file = "output-{0}.data".format(index) video_sink = VideoFileSink(PATH, 3001, out_file) sources.new_test_video(pattern=4) sources.new_test_video(pattern=5) controller = Controller() time.sleep(1) res = controller.mark_face(faces) print res time.sleep(1) sources.terminate_video() preview.terminate() video_sink.terminate() serv.terminate(1) if not generate_frames: assert res is not None assert self.verify_output(index, out_file) is True finally: if serv.proc: poll = serv.proc.poll() print self.__class__ if poll == -11: print "SEGMENTATION FAULT OCCURRED" print "ERROR CODE - {0}".format(poll) serv.terminate(1) log = open('server.log') print log.read()
def mark_face(self, faces, index, generate_frames=False): """Create the Controller object and call mark_face method""" for _ in range(self.NUM): serv = Server(path=PATH) try: serv.run() sources = TestSources(video_port=3000) preview = PreviewSinks() preview.run() out_file = "output-{0}.data".format(index) video_sink = VideoFileSink(3001, out_file) sources.new_test_video(pattern=4) sources.new_test_video(pattern=5) controller = Controller() time.sleep(1) res = controller.mark_face(faces) print res time.sleep(1) sources.terminate_video() preview.terminate() video_sink.terminate() serv.terminate(1) if not generate_frames: assert res is not None assert self.verify_output(index, out_file) is True finally: if serv.proc: poll = serv.proc.poll() print self.__class__ if poll == -11: print "SEGMENTATION FAULT OCCURRED" print "ERROR CODE - {0}".format(poll) serv.terminate(1) log = open('server.log') print log.read()