def test_start_stop(): stages = [ mock.MagicMock(), mock.MagicMock(), mock.MagicMock(), ] pipeline = SpeechPipeline(mock.MagicMock(), stages=stages) pipeline.start() assert pipeline.is_running # test second call to start, which ignores if the pipeline is running pipeline.start() pipeline.step() pipeline.close() assert not pipeline.is_running
def test_pause_resume(): stages = [ mock.MagicMock(), mock.MagicMock(), mock.MagicMock(), ] pipeline = SpeechPipeline(mock.MagicMock(), stages=stages) pipeline.start() assert pipeline.is_running pipeline.step() pipeline.pause() pipeline._input_source.stop.assert_called() # verify it does nothing pipeline.step() pipeline.resume() pipeline._input_source.start.assert_called() pipeline.close()