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.
This commit is contained in:
Alex Pyrgiotis 2024-09-26 17:40:28 +03:00
parent dc8a22c8e7
commit b5130b08b6
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -28,17 +28,17 @@ class DummyWait(Dummy):
start_new_session=True, start_new_session=True,
) )
def terminate_doc_to_pixels_proc(
self, document: Document, p: subprocess.Popen
) -> None:
p.terminate()
@pytest.fixture @pytest.fixture
def provider_wait() -> DummyWait: def provider_wait() -> DummyWait:
return DummyWait() return DummyWait()
@pytest.fixture
def provider() -> Dummy:
return Dummy()
class TestDummyTermination(IsolationProviderTermination): class TestDummyTermination(IsolationProviderTermination):
def test_failed( def test_failed(
self, self,
@ -51,3 +51,12 @@ class TestDummyTermination(IsolationProviderTermination):
return_value=errors.DocFormatUnsupported(), return_value=errors.DocFormatUnsupported(),
) )
super().test_failed(provider_wait, mocker) 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)