tests: Avoid using threads in tests

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ář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-06-18 13:15:29 +02:00
parent 2c3e6a5a74
commit d01084337e
1 changed files with 6 additions and 0 deletions

View File

@ -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")