MCPcopy Create free account
hub / github.com/dagger/dagger / test_query_error

Function test_query_error

sdk/python/tests/client/test_execute_errors.py:62–79  ·  view source on GitHub ↗
(client: dagger.Client, httpx_mock: HTTPXMock)

Source from the content-addressed store, hash-verified

60
61
62async def test_query_error(client: dagger.Client, httpx_mock: HTTPXMock):
63 msg = "invalid reference format"
64 error = {
65 "message": msg,
66 "path": ["container", "from"],
67 "locations": [{"line": 3, "column": 5}],
68 }
69 httpx_mock.add_response(json={"errors": [error]})
70
71 with pytest.raises(dagger.QueryError) as exc_info:
72 await client.container().from_("invalid!")
73
74 exc = exc_info.value
75 assert msg in str(exc)
76 assert exc.errors[0].path == ["container", "from"]
77 assert exc.errors[0].locations is not None
78 assert exc.errors[0].locations[0].line == 3
79 assert exc.errors[0].locations[0].column == 5
80
81
82async def test_no_path_query_error(client: dagger.Client, httpx_mock: HTTPXMock):

Callers

nothing calls this directly

Calls 2

from_Method · 0.80
containerMethod · 0.45

Tested by

no test coverage detected