From 5ac5c1eac2e54d18a7da285272358d673604dab0 Mon Sep 17 00:00:00 2001 From: kissiel Date: Wed, 17 Jan 2024 14:49:46 +0100 Subject: [PATCH] Cut down time it takes to run base provider unit tests by 95% (Infra) (#943) mock out the sleeps in tests --- providers/base/tests/test_pipewire_test.py | 3 ++- providers/base/tests/test_pipewire_utils.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/providers/base/tests/test_pipewire_test.py b/providers/base/tests/test_pipewire_test.py index 3c40f3d16..63a162a7b 100644 --- a/providers/base/tests/test_pipewire_test.py +++ b/providers/base/tests/test_pipewire_test.py @@ -101,8 +101,9 @@ def test_wpctl_output_succ(self, mock_checkout): '1'], universal_newlines=True) + @patch("time.sleep") @patch("subprocess.check_output") - def test_wpctl_output_fail(self, mock_checkout): + def test_wpctl_output_fail(self, mock_checkout, _): vc = VolumeController(type='input', logger=MagicMock()) mock_checkout.side_effect = subprocess.CalledProcessError(2, "echo") with self.assertRaises(SystemExit) as cm: diff --git a/providers/base/tests/test_pipewire_utils.py b/providers/base/tests/test_pipewire_utils.py index a19ca9b35..83eadb9fa 100644 --- a/providers/base/tests/test_pipewire_utils.py +++ b/providers/base/tests/test_pipewire_utils.py @@ -385,9 +385,9 @@ def test_wrong_gst_pipeline_device(self, mock_checkout): mock_checkout.return_value = self.device self.assertEqual(PipewireTestError.NO_SPECIFIC_DEVICE, pt.gst_pipeline("pipe", 10, "qoo")) - + @patch("time.sleep") @patch("subprocess.check_output") - def test_gst_pipeline(self, mock_checkout): + def test_gst_pipeline(self, mock_checkout, _): pt = PipewireTest() mock_checkout.return_value = self.device @@ -485,8 +485,9 @@ class MonitorActivePortTests(unittest.TestCase): } }]""" + @patch("time.sleep") @patch("subprocess.check_output") - def test_couldnt_detect_change(self, mock_checkout): + def test_couldnt_detect_change(self, mock_checkout, _): pt = PipewireTest() mock_checkout.return_value = self.before_device