Skip to content

Commit

Permalink
Tests: test_addgroup: Fix soft timeout warnings to point to test code…
Browse files Browse the repository at this point in the history
… rather than to infrastructure
  • Loading branch information
davidfstr committed Jan 9, 2024
1 parent 204ca8b commit d5838a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/crystal/tests/test_addgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,12 @@ async def _expand_node(node_ti: TreeItem, mw: Optional[MainWindow]=None, *, will
if will_download:
if mw is None:
raise ValueError('Need mw parameter when will_download=True')
await wait_for_download_to_start_and_finish(mw.task_tree)
await wait_for(first_child_of_tree_item_is_not_loading_condition(node_ti))
await wait_for_download_to_start_and_finish(
mw.task_tree,
stacklevel_extra=1)
await wait_for(
first_child_of_tree_item_is_not_loading_condition(node_ti),
stacklevel_extra=1)


async def _source_name_for_node(node_ti: TreeItem, mw: MainWindow) -> Optional[str]:
Expand Down
3 changes: 2 additions & 1 deletion src/crystal/tests/util/wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async def wait_for(
timeout: Optional[float]=None,
*, period: Optional[float]=None,
message: Optional[Callable[[], str]]=None,
stacklevel_extra: int=0,
) -> _T:
"""
Waits up to `timeout` seconds for the specified condition to become non-None,
Expand Down Expand Up @@ -150,7 +151,7 @@ async def wait_for(
soft_timeout,
message_suffix_str
),
stacklevel=2)
stacklevel=(2 + stacklevel_extra))


class WaitTimedOut(Exception):
Expand Down

0 comments on commit d5838a3

Please sign in to comment.