From 2e33e8adab055cf7b542a07f8ae161e3df8bb55d Mon Sep 17 00:00:00 2001 From: Shahmir Varqha Date: Sat, 25 Jan 2025 12:30:54 +0800 Subject: [PATCH] prevent flaky test --- tests/_cli/test_cli_export.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.py index 2e7a4edd9ae..57c0488f3c1 100644 --- a/tests/_cli/test_cli_export.py +++ b/tests/_cli/test_cli_export.py @@ -7,6 +7,7 @@ import shutil import subprocess import sys +import time from os import path from pathlib import Path from typing import TYPE_CHECKING @@ -162,6 +163,7 @@ def test_cli_export_html_wasm_read(temp_marimo_file: str) -> None: ) assert " None: out_dir = Path(temp_marimo_file).parent / "out" @@ -180,7 +182,7 @@ def test_cli_export_html_wasm_watch(temp_marimo_file: str) -> None: ) watch_echo_found = False - for _ in range(10): # try 10 times + for _ in range(10): # read 10 lines line = p.stdout.readline() if not line: break @@ -188,6 +190,7 @@ def test_cli_export_html_wasm_watch(temp_marimo_file: str) -> None: if f"Watching {temp_marimo_file}" in line_str: watch_echo_found = True break + time.sleep(0.01) # avoid flaky test assert watch_echo_found is True # Modify file @@ -200,6 +203,7 @@ def test_cli_export_html_wasm_watch(temp_marimo_file: str) -> None: if line: assert "Re-exporting" in line break + time.sleep(0.01) @staticmethod def test_cli_export_async(temp_async_marimo_file: str) -> None: