File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 33import typing as t
44
55from libtmux import exc
6+ from libtmux ._internal .query_list import ObjectDoesNotExist
67from libtmux .common import tmux_cmd
78from libtmux .formats import FORMAT_SEPARATOR
89
@@ -239,6 +240,12 @@ def fetch_obj(
239240 if _obj .get (obj_key ) == obj_id :
240241 obj = _obj
241242
243+ if obj is None :
244+ raise ObjectDoesNotExist (
245+ f"Could not find { obj_key } ={ obj_id } for { list_cmd } "
246+ f'{ list_extra_args if list_extra_args is not None else "" } '
247+ )
248+
242249 assert obj is not None
243250
244251 return obj
Original file line number Diff line number Diff line change 77import pytest
88
99from libtmux import exc
10+ from libtmux ._internal .query_list import ObjectDoesNotExist
1011from libtmux .common import has_gte_version , has_lt_version
1112from libtmux .pane import Pane
1213from libtmux .server import Server
@@ -205,7 +206,7 @@ def test_kill_window(session: Session) -> None:
205206 w .window_id
206207
207208 w .kill_window ()
208- with pytest .raises (AssertionError ): # TODO: Replace this will an object not found
209+ with pytest .raises (ObjectDoesNotExist ):
209210 w .refresh ()
210211
211212
You can’t perform that action at this time.
0 commit comments