From b5130b08b632a825fa8c52c092ebd26e6d190531 Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Thu, 26 Sep 2024 17:40:28 +0300 Subject: [PATCH] tests: Improve Dummy provider tests Add a fixture that returns our stock Dummy provider. Also, explicitly use a blocking Dummy provider (`DummyWait`) for a specific test case. This will prove useful when we stop using the `provider_wait` variant of our isolation providers in the next commits. --- tests/isolation_provider/test_dummy.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/isolation_provider/test_dummy.py b/tests/isolation_provider/test_dummy.py index 9ba155d..1002687 100644 --- a/tests/isolation_provider/test_dummy.py +++ b/tests/isolation_provider/test_dummy.py @@ -28,17 +28,17 @@ class DummyWait(Dummy): start_new_session=True, ) - def terminate_doc_to_pixels_proc( - self, document: Document, p: subprocess.Popen - ) -> None: - p.terminate() - @pytest.fixture def provider_wait() -> DummyWait: return DummyWait() +@pytest.fixture +def provider() -> Dummy: + return Dummy() + + class TestDummyTermination(IsolationProviderTermination): def test_failed( self, @@ -51,3 +51,12 @@ class TestDummyTermination(IsolationProviderTermination): return_value=errors.DocFormatUnsupported(), ) super().test_failed(provider_wait, mocker) + + def test_linger_unkillable( + self, + provider_wait: IsolationProvider, + mocker: MockerFixture, + ) -> None: + # We have to spawn a blocking process here, else we can't imitate an + # "unkillable" process. + super().test_linger_unkillable(provider_wait, mocker)