tests: Restore previously mocked function

Restore the `isolation_provider.base.kill_process_group()` function,
which was previously mocked, at the end of the
`test_linger_unkillable()` test. This function is initially mocked, in
order to simulate a hang process. After the mocking completes, the test
needs the original function once more, in order to actually kill the
spawned process.
This commit is contained in:
Alex Pyrgiotis 2024-10-30 16:19:34 +02:00 committed by Alexis Métaireau
parent 59e1666c28
commit d561878e03
No known key found for this signature in database
GPG key ID: C65C7A89A8FFC56E

View file

@ -164,6 +164,7 @@ class IsolationProviderTermination:
terminate_proc_mock = mocker.patch.object(
provider, "terminate_doc_to_pixels_proc", return_value=None
)
kill_pg_orig = base.kill_process_group
kill_pg_mock = mocker.patch(
"dangerzone.isolation_provider.base.kill_process_group", return_value=None
)
@ -178,6 +179,7 @@ class IsolationProviderTermination:
# Reset the function to the original state.
provider.terminate_doc_to_pixels_proc = terminate_proc_orig # type: ignore [method-assign]
base.kill_process_group = kill_pg_orig
# Really kill the spawned process, so that it doesn't linger after the tests
# complete.