Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.
Python ai-toolsauto-captionscaptionscliffmpegmcpmcp-serveropusclip-alternativepodcast-clipspodcastsshortform-videovertical-videowhisper
tests: isolate encoder.get_encoder_info cache between runs
Nika Siradze8eddc5088f12
diff --git a/tests/test_encoder.py b/tests/test_encoder.pyindex 0bc877d..360323b 100644--- a/tests/test_encoder.py+++ b/tests/test_encoder.py@@ -74,6 +74,20 @@ class GetVideoEncodeFlagsTests(unittest.TestCase):class GetEncoderInfoTests(unittest.TestCase):+ def setUp(self):+ # Isolate the on-disk cache so each test exercises detect_encoders directly.+ import tempfile+ self._tmpdir = tempfile.TemporaryDirectory()+ self._cache_path = os.path.join(self._tmpdir.name, "encoder.json")+ self._cache_patch = mock.patch.object(+ encoder, "_encoder_cache_path", return_value=self._cache_path+ )+ self._cache_patch.start()++ def tearDown(self):+ self._cache_patch.stop()+ self._tmpdir.cleanup()+def test_returns_detect_encoders_output_on_success(self):fake_info = {"available": ["libx264", "h264_nvenc"], "best": "h264_nvenc"}with mock.patch.object(encoder, "detect_encoders", return_value=fake_info):@@ -86,6 +100,13 @@ class GetEncoderInfoTests(unittest.TestCase):self.assertIn("libx264", info["available"])self.assertIn("libx264", info["best_flags"])+ def test_caches_result_between_calls(self):+ fake_info = {"available": ["libx264", "h264_nvenc"], "best": "h264_nvenc"}+ with mock.patch.object(encoder, "detect_encoders", return_value=fake_info) as detect:+ encoder.get_encoder_info()+ encoder.get_encoder_info()+ self.assertEqual(detect.call_count, 1)+if __name__ == "__main__":unittest.main()