Skip to content

Commit 73e7fbd

Browse files
committed
conftest
1 parent 630fb43 commit 73e7fbd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/tests/conftest.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def __init__(self, log: str) -> None:
3131
self._init_ws()
3232
self._drain_initial_messages()
3333

34-
def call(self, rpc: str, params: List[Dict[str, Any]] = None) -> None:
34+
def call(self, rpc: str, params: Optional[List[Dict[str, Any]]] = None) -> None:
3535
if params is None:
3636
params = [{}]
37-
return self.ws.send(
37+
self.ws.send(
3838
json.dumps(
3939
{
4040
"id": "rpc:test",
@@ -60,7 +60,10 @@ def get_response(self) -> Union[bytes, Dict[str, Any], str]:
6060
return response
6161
try:
6262
parsed = json.loads(response)
63-
return parsed
63+
if isinstance(parsed, dict):
64+
return parsed
65+
else:
66+
return str(parsed)
6467
except Exception:
6568
return str(response)
6669

@@ -132,7 +135,7 @@ def _init_ws(self) -> None:
132135
}
133136
)
134137
)
135-
self.call("viewport.image.push.observer.add", [-1])
138+
self.call("viewport.image.push.observer.add", [{"observer_id": -1}])
136139

137140
def _drain_initial_messages(
138141
self, max_messages: int = 5, timeout: float = 4.0
@@ -184,7 +187,7 @@ def server(xprocess: Any) -> Generator[ServerMonitor, None, None]:
184187

185188

186189
@pytest.fixture(scope="session", autouse=True)
187-
def configure_test_environment() -> None:
190+
def configure_test_environment() -> Generator[None, None, None]:
188191
base_path = Path(__file__).parent
189192
config.test_config(base_path)
190193
db_path = base_path / "project.db"

0 commit comments

Comments
 (0)