mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
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:
parent
dc8a22c8e7
commit
b5130b08b6
1 changed files with 14 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue