Skip to content

Commit

Permalink
tests: Improve Dummy provider tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
apyrgio committed Oct 7, 2024
1 parent dc8a22c commit b5130b0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tests/isolation_provider/test_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ def start_doc_to_pixels_proc(self, document: Document) -> subprocess.Popen:
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,
Expand All @@ -51,3 +51,12 @@ def test_failed(
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)

0 comments on commit b5130b0

Please sign in to comment.