Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Assert Rust Laminar span flushing

Magnus Müller4bcce6e44994
diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.py
index b9627ef1c..72367cd4c 100644
--- a/tests/ci/test_rust_agent.py
+++ b/tests/ci/test_rust_agent.py
@@ -7477,6 +7477,7 @@ def test_rust_agent_laminar_run_summary_populates_current_span(monkeypatch):
outputs = []
events = []
spans = []
+ flushes = 0
current_span = None
@staticmethod
@@ -7501,6 +7502,10 @@ def test_rust_agent_laminar_run_summary_populates_current_span(monkeypatch):
def event(cls, name, attributes=None):
cls.events.append((name, attributes))
+ @classmethod
+ def flush(cls):
+ cls.flushes += 1
+
@classmethod
def start_as_current_span(cls, name, input=None, span_type='DEFAULT'):
record = {'name': name, 'input': input, 'span_type': span_type, 'attributes': [], 'outputs': []}
@@ -7697,6 +7702,7 @@ def test_rust_agent_laminar_run_summary_populates_current_span(monkeypatch):
'type': 'image_url',
'image_url': {'url': 'data:image/png;base64,iVBORw0KGgo=', 'detail': 'low'},
}
+ assert FakeLaminar.flushes == 2
def test_rust_agent_laminar_tool_span_preserves_image_only_outputs(tmp_path):
@@ -7724,6 +7730,7 @@ def test_rust_agent_laminar_tool_span_preserves_image_only_outputs(tmp_path):
class FakeLaminar:
spans = []
+ flushes = 0
current_span = None
@staticmethod
@@ -7744,6 +7751,10 @@ def test_rust_agent_laminar_tool_span_preserves_image_only_outputs(tmp_path):
def event(cls, name, attributes=None):
return None
+ @classmethod
+ def flush(cls):
+ cls.flushes += 1
+
@classmethod
def start_as_current_span(cls, name, input=None, span_type='DEFAULT'):
record = {'name': name, 'input': input, 'span_type': span_type, 'attributes': [], 'outputs': []}
@@ -7769,6 +7780,7 @@ def test_rust_agent_laminar_tool_span_preserves_image_only_outputs(tmp_path):
output = FakeLaminar.spans[0]['outputs'][-1]
assert output[0]['content'] == [{'type': 'image_url', 'image_url': {'url': 'data:image/png;base64,iVBORw0KGgo='}}]
+ assert FakeLaminar.flushes == 1
async def test_rust_agent_authenticate_cloud_sync_logs_browser_use_warning(monkeypatch):