Skip to content

Commit

Permalink
Tests: Bump timeout related to: test_shell_exits_with_expected_message
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfstr committed Dec 31, 2023
1 parent 4ce8245 commit e068627
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/crystal/tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from crystal import __version__ as crystal_version
from crystal.tests.util.asserts import *
from crystal.tests.util.wait import DEFAULT_WAIT_PERIOD, DEFAULT_WAIT_TIMEOUT, WaitTimedOut
from crystal.tests.util.windows import MainWindow
from crystal.tests.util.screenshots import screenshot_if_raises
from crystal.tests.util.server import served_project
from crystal.tests.util.subtests import SubtestsContext, with_subtests
Expand Down Expand Up @@ -646,7 +647,10 @@ async def close_main_window():
t = Thread(target=lambda: run_test(close_main_window))
t.start()
'''), stop_suffix=_OK_THREAD_STOP_SUFFIX if after_delay is None else '')
'''),
stop_suffix=_OK_THREAD_STOP_SUFFIX if after_delay is None else '',
timeout=MainWindow.CLOSE_TIMEOUT,
)


@contextmanager
Expand Down
4 changes: 3 additions & 1 deletion src/crystal/tests/util/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,16 @@ def task_count_changed_condition() -> Optional[int]:

# === Close ===

CLOSE_TIMEOUT = 4.0

async def close(self, exc_info=None) -> None:
# Try wait for any lingering tasks to complete.
#
# Does workaround: https://github.com/davidfstr/Crystal-Web-Archiver/issues/74
try:
await wait_for(
tree_has_no_children_condition(self.task_tree),
timeout=4.0) # wait only briefly
timeout=self.CLOSE_TIMEOUT) # wait only briefly
except WaitTimedOut:
first_task_title = first_task_title_progression(self.task_tree)()
print(f'*** MainWindow: Closing while tasks are still running. May deadlock! Current task: {first_task_title}')
Expand Down

0 comments on commit e068627

Please sign in to comment.