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:
parent
2c3e6a5a74
commit
d01084337e
@ -18,6 +18,12 @@ from pungi.phases import init
|
|||||||
from tests.helpers import DummyCompose, PungiTestCase, touch, mk_boom
|
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_comps")
|
||||||
@mock.patch("pungi.phases.init.validate_module_defaults")
|
@mock.patch("pungi.phases.init.validate_module_defaults")
|
||||||
@mock.patch("pungi.phases.init.write_module_defaults")
|
@mock.patch("pungi.phases.init.write_module_defaults")
|
||||||
|
Loading…
Reference in New Issue
Block a user