Forge
pythonf8555a15
1"""Smoke tests for package bootstrap."""
2
3from __future__ import annotations
4
5import pytest
6
7import pywitdb
8from pywitdb.exceptions import BridgeNotAvailableError
9
10
11def test_version() -> None:
12 assert pywitdb.__version__ == "0.1.0"
13
14
15def test_open_bridge_backend() -> None:
16 from pywitdb._bridge.client import bridge_available
17
18 if not bridge_available():
19 with pytest.raises(BridgeNotAvailableError):
20 pywitdb.open(":memory:", backend="bridge")
21 return
22
23 import tempfile
24 from pathlib import Path
25
26 with tempfile.TemporaryDirectory() as tmp:
27 path = str(Path(tmp) / "bootstrap.witdb")
28 with pywitdb.open(path, backend="bridge") as db:
29 db.put(b"boot", b"ok")
30 assert db.get(b"boot") == b"ok"
31
View only · write via MCP/CIDE