A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
test flake: remove scheduler timing from async progress test (#10603)
Shahmir Varqhadece009b8d62
diff --git a/tests/_plugins/stateless/status/test_progress.py b/tests/_plugins/stateless/status/test_progress.pyindex 81240621df..d39f5f8fd0 100644--- a/tests/_plugins/stateless/status/test_progress.py+++ b/tests/_plugins/stateless/status/test_progress.py@@ -2,7 +2,7 @@from __future__ import annotationsimport time-from typing import Any+from typing import TYPE_CHECKING, Anyfrom unittest.mock import patchimport pytest@@ -14,6 +14,9 @@ from marimo._plugins.stateless.status._progress import ()from marimo._runtime.context.types import runtime_context_installed+if TYPE_CHECKING:+ from collections.abc import AsyncIterator+# Test initializationdef test_progress_init() -> None:@@ -183,20 +186,22 @@ def test_progress_with_stepped_range_and_total() -> None:assert (progress.progress.current, progress.progress.total) == (10, 10)-async def sleep(seconds):+async def async_items(items: list[int]) -> AsyncIterator[int]:import asyncio- tasks = [asyncio.create_task(asyncio.sleep(s, s)) for s in seconds]- for future in asyncio.as_completed(tasks):- yield await future+ for item in items:+ await asyncio.sleep(0)+ yield itemasync def test_progress_async():assert runtime_context_installed() is False- ait = sleep([0.01, 0.003, 0.001])- result = [s async for s in progress_bar(ait, total=3)]- assert result == [0.001, 0.003, 0.01]+ progress = progress_bar(async_items([1, 2, 3]), total=3)+ result = [item async for item in progress]++ assert result == [1, 2, 3]+ assert progress.progress.current == 3def test_progress_no_total_error():