Skip to content

Commit

Permalink
Wait longer to avoid flakiness (#6001)
Browse files Browse the repository at this point in the history
Quick fix for a flaky test introduced in #5950.
  • Loading branch information
seeM authored Jan 15, 2025
1 parent af026da commit c2d03de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

import os
import time
from threading import Timer
from typing import Any, Dict, List, Optional, cast
from unittest.mock import Mock

Expand Down Expand Up @@ -332,5 +332,7 @@ def test_close_notebook_cell_clears_diagnostics():

# Wait for the diagnostics to be published
server.publish_diagnostics.assert_not_called()
time.sleep(0.06)
timers: List[Timer] = list(_clear_diagnostics_debounced.timers.values()) # type: ignore
for timer in timers:
timer.join()
server.publish_diagnostics.assert_called_once_with(params.text_document.uri, [])
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ def run() -> None:
# Store the interval on the debounced function; we lower the interval for faster tests.
debounced.interval_s = interval_s # type: ignore

# Store timers on the debounced function; we wait for them to finish in tests.
debounced.timers = timers # type: ignore

return debounced

return wrapper

0 comments on commit c2d03de

Please sign in to comment.