From d01084337e82f1144994933a11feff64767e07b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 18 Jun 2019 13:15:29 +0200 Subject: [PATCH] tests: Avoid using threads in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Starting tests just to run mock functions slows the tests down for no good reason. Let's instead mock the runner and run the dummy tasks serially. Signed-off-by: Lubomír Sedlář --- tests/test_initphase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_initphase.py b/tests/test_initphase.py index 250c3ed3..2a72e370 100644 --- a/tests/test_initphase.py +++ b/tests/test_initphase.py @@ -18,6 +18,12 @@ from pungi.phases import init from tests.helpers import DummyCompose, PungiTestCase, touch, mk_boom +def fake_run_in_threads(func, params, threads=None): + for num, param in enumerate(params): + func(None, param, num) + + +@mock.patch("pungi.phases.init.run_in_threads", new=fake_run_in_threads) @mock.patch("pungi.phases.init.validate_comps") @mock.patch("pungi.phases.init.validate_module_defaults") @mock.patch("pungi.phases.init.write_module_defaults")