Skip to content

Commit

Permalink
SQ -> Tests: Shell: _read_until: Rewrite to no longer use sleep() and…
Browse files Browse the repository at this point in the history
… polling, preferring select() instead
  • Loading branch information
davidfstr committed Jan 9, 2024
1 parent d5838a3 commit c2fe0dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/crystal/tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ def _read_until(
if did_time_out:
# Look for an acceptable "stop suffix"
# Special case: '' is always an acceptable `stop_suffix`
if '' in stop_suffix_bytes_choices:
if '' in stop_suffix:
found_stop_suffix = ''
else:
# Read stream
Expand Down
4 changes: 3 additions & 1 deletion src/crystal/tests/util/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
async def wait_for_download_to_start_and_finish(
task_tree: wx.TreeCtrl,
*, immediate_finish_ok: bool=False,
stacklevel_extra: int=0
) -> None:
# TODO: Allow caller to tune "max_download_duration_per_item"
max_download_duration_per_standard_item = (
Expand All @@ -38,7 +39,8 @@ async def wait_for_download_to_start_and_finish(
try:
await wait_for(
tree_has_children_condition(task_tree),
timeout=4.0) # 2.0s isn't long enough for Windows test runners on GitHub Actions
timeout=4.0, # 2.0s isn't long enough for Windows test runners on GitHub Actions
stacklevel_extra=(1 + stacklevel_extra))
except WaitTimedOut:
if immediate_finish_ok:
return
Expand Down

0 comments on commit c2fe0dc

Please sign in to comment.