From 328ddbe5be9f2ccdf986c2ea18a47cf92ce0dc01 Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Tue, 8 Oct 2024 19:02:39 +0300 Subject: [PATCH] tests: Remove provider_wait fixtures --- tests/isolation_provider/test_container.py | 25 ---------------------- tests/isolation_provider/test_qubes.py | 7 +----- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/tests/isolation_provider/test_container.py b/tests/isolation_provider/test_container.py index 860cf9f54..48f8d68fb 100644 --- a/tests/isolation_provider/test_container.py +++ b/tests/isolation_provider/test_container.py @@ -21,31 +21,6 @@ def provider() -> Container: return Container() -class ContainerWait(Container): - """Container isolation provider that blocks until the container has started.""" - - def exec_container(self, *args, **kwargs): # type: ignore [no-untyped-def] - # Check every 100ms if a container with the expected name has showed up. - # Else, closing the file descriptors may not work. - name = kwargs["name"] - runtime = self.get_runtime() - p = super().exec_container(*args, **kwargs) - for i in range(50): - containers = subprocess.run( - [runtime, "ps"], capture_output=True - ).stdout.decode() - if name in containers: - return p - time.sleep(0.1) - - raise RuntimeError(f"Container {name} did not start within 5 seconds") - - -@pytest.fixture -def provider_wait() -> ContainerWait: - return ContainerWait() - - class TestContainer(IsolationProviderTest): pass diff --git a/tests/isolation_provider/test_qubes.py b/tests/isolation_provider/test_qubes.py index e3b0b28d5..d011a65e4 100644 --- a/tests/isolation_provider/test_qubes.py +++ b/tests/isolation_provider/test_qubes.py @@ -20,11 +20,6 @@ pytest.skip("Dummy conversion is enabled", allow_module_level=True) -@pytest.fixture -def provider() -> Qubes: - return Qubes() - - class QubesWait(Qubes): """Qubes isolation provider that blocks until the disposable qube has started.""" @@ -53,7 +48,7 @@ def start_doc_to_pixels_proc(self, document: Document) -> subprocess.Popen: @pytest.fixture -def provider_wait() -> QubesWait: +def provider() -> QubesWait: return QubesWait()