From c756898d16792a5108e999726cf1f4c7021dc147 Mon Sep 17 00:00:00 2001 From: libraz Date: Sat, 31 May 2025 19:03:31 +0900 Subject: [PATCH] Add quiet option test for CLI --- tests/test_cli.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 34aa9bf..f514f70 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -222,5 +222,26 @@ def test_main_with_options(self): self.assertEqual(args.max_bpm, 200.0) + @patch("bpm_detector.cli.analyze_file_with_progress") + @patch("os.path.exists") + def test_main_quiet_option(self, mock_exists, mock_analyze): + """Test that --quiet disables progress display.""" + mock_exists.return_value = True + + test_args = ["bpm-detector", "--quiet", "test.wav"] + + with patch("sys.argv", test_args): + with patch("sys.stdout", io.StringIO()): + main() + + # Should call analyze_file_with_progress once + mock_analyze.assert_called_once() + + # Args should have progress disabled + call_args = mock_analyze.call_args[0] + args = call_args[2] + self.assertFalse(args.progress) + + if __name__ == "__main__": unittest.main()