Skip to content

Commit 4c6e13d

Browse files
committed
More fixes
1 parent 1204e7c commit 4c6e13d

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126

127127
- name: Install offwork + dev deps
128128
run: |
129-
pip install -e ".[redis,rabbitmq]"
129+
pip install -e ".[redis,rabbitmq,ws]"
130130
pip install mypy pytest pytest-asyncio
131131
132132
- name: Run mypy

offwork/worker/backends/ws.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
from typing import Any
3232
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
3333

34+
try:
35+
import websockets
36+
except ImportError:
37+
raise ImportError(
38+
"websockets package is required for RabbitMQBackend. "
39+
"Install it with: pip install websockets"
40+
) from None
41+
3442
from offwork.core.version import _VERSION
3543
from offwork.worker.backends.base import Backend
3644

@@ -86,13 +94,6 @@ def __init__(self, url: str, *, role: str = "client") -> None:
8694
# ------------------------------------------------------------------ #
8795

8896
async def _connect(self) -> Any:
89-
try:
90-
import websockets
91-
except ImportError as exc:
92-
raise RuntimeError(
93-
"WebSocketBackend requires the 'websockets' package. "
94-
"Install with: pip install 'offwork[ws]'"
95-
) from exc
9697
ws = await websockets.connect(
9798
self._url,
9899
max_size=None, # broker payloads (graph_json) can be large

tests/test_graph.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ def test_deduplication_shared_dep(tmp_path: Path) -> None:
352352
def test_serialize_format_structure(tmp_path: Path) -> None:
353353
graph = _make_graph(tmp_path)
354354
data = json.loads(graph.serialize())
355-
assert data["version"].startswith("0.2")
356355
assert "objects" in data
357356
assert "deps" in data
358357
assert "refs" in data

tests/test_store.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ def test_json_roundtrip(self) -> None:
332332
def test_to_dict_format(self) -> None:
333333
store = _chain_store()
334334
data = store.to_dict()
335-
assert data["version"].startswith("0.2")
336335
assert "objects" in data
337336
assert "deps" in data
338337
assert "refs" in data

0 commit comments

Comments
 (0)