Handle optional Docker dependencies in benchmark unit tests

This commit is contained in:
酱牛肉 2026-10-14 21:23:19 +08:00
parent 461e4c6fb7
commit 1d210d0f40
3 changed files with 7 additions and 4 deletions

View file

@ -38,7 +38,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e reme_studio -e ".[dev,core]"
pip install -e reme_studio -e ".[dev,core,benchmark-docker]"
pip install --no-deps -e plugins/auto-fin
pip install -e plugins/daily_paper
pip install -e plugins/lme -e plugins/beam

View file

@ -1299,6 +1299,7 @@ async def test_pool_retries_strict_delete_without_replacing_uncertain_container(
from types import SimpleNamespace
from unittest.mock import AsyncMock
pytest.importorskip("aiodocker")
from deploy.benchmark_docker.direct_docker_workspace import DirectDockerWorkspace
workspaces = []
@ -1306,6 +1307,8 @@ async def test_pool_retries_strict_delete_without_replacing_uncertain_container(
client = SimpleNamespace(close=AsyncMock())
class StrictWorkspace(DirectDockerWorkspace):
# Provisioning deliberately populates the inherited Docker handles.
# pylint: disable=attribute-defined-outside-init
async def _provision_backend(self):
self._container, self._client, self._backend = container, client, TimedOutBackend()

View file

@ -1,15 +1,15 @@
"""Direct workspace lifecycle without a Docker daemon."""
# pylint: disable=missing-function-docstring,protected-access
# pylint: disable=missing-function-docstring,protected-access,wrong-import-position
import asyncio
from types import SimpleNamespace
from unittest.mock import AsyncMock
from aiodocker.exceptions import DockerError
import pytest
from deploy.benchmark_docker.direct_docker_workspace import DirectDockerWorkspace
DockerError = pytest.importorskip("aiodocker.exceptions").DockerError
from deploy.benchmark_docker.direct_docker_workspace import DirectDockerWorkspace # noqa: E402
def make_workspace():