def test_cleanup(): stages = [ mock.MagicMock(), mock.MagicMock(), mock.MagicMock(), ] pipeline = SpeechPipeline(mock.MagicMock(), stages=stages) pipeline.start() assert pipeline.is_running pipeline.stop() assert not pipeline.is_running pipeline.cleanup() assert not pipeline._stages assert not pipeline._input_source
def test_cleanup(): stages = [ mock.MagicMock(), mock.MagicMock(), mock.MagicMock(), ] pipeline = SpeechPipeline(mock.MagicMock(), stages=stages) pipeline.start() assert pipeline.is_running pipeline.stop() assert not pipeline.is_running # run after stopped will trigger clean up pipeline.run() assert not pipeline._stages assert not pipeline._input_source
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.stop() assert not pipeline.is_running pipeline.close()