Skip to content

Commit aec0666

Browse files
fix tests
1 parent c7ce154 commit aec0666

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

examples/financial_research_agent/manager.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ async def run(self, query: str) -> None:
4242
is_done=True,
4343
hide_checkmark=True,
4444
)
45-
self.printer.update_item(
46-
"start", "Starting financial research...", is_done=True)
45+
self.printer.update_item("start", "Starting financial research...", is_done=True)
4746
search_plan = await self._plan_searches(query)
4847
search_results = await self._perform_searches(search_plan)
4948
report = await self._write_report(query, search_results)
5049
verification = await self._verify_report(report)
5150

5251
final_report = f"Report summary\n\n{report.short_summary}"
53-
self.printer.update_item(
54-
"final_report", final_report, is_done=True)
52+
self.printer.update_item("final_report", final_report, is_done=True)
5553

5654
self.printer.end()
5755

@@ -76,8 +74,7 @@ async def _plan_searches(self, query: str) -> FinancialSearchPlan:
7674
async def _perform_searches(self, search_plan: FinancialSearchPlan) -> Sequence[str]:
7775
with custom_span("Search the web"):
7876
self.printer.update_item("searching", "Searching...")
79-
tasks = [asyncio.create_task(self._search(item))
80-
for item in search_plan.searches]
77+
tasks = [asyncio.create_task(self._search(item)) for item in search_plan.searches]
8178
results: list[str] = []
8279
num_completed = 0
8380
for task in asyncio.as_completed(tasks):
@@ -112,8 +109,7 @@ async def _write_report(self, query: str, search_results: Sequence[str]) -> Fina
112109
tool_description="Use to get a short write‑up of potential red flags",
113110
custom_output_extractor=_summary_extractor,
114111
)
115-
writer_with_tools = writer_agent.clone(
116-
tools=[fundamentals_tool, risk_tool])
112+
writer_with_tools = writer_agent.clone(tools=[fundamentals_tool, risk_tool])
117113
self.printer.update_item("writing", "Thinking about report...")
118114
input_data = f"Original query: {query}\nSummarized search results: {search_results}"
119115
result = Runner.run_streamed(writer_with_tools, input_data)
@@ -126,8 +122,7 @@ async def _write_report(self, query: str, search_results: Sequence[str]) -> Fina
126122
next_message = 0
127123
async for _ in result.stream_events():
128124
if time.time() - last_update > 5 and next_message < len(update_messages):
129-
self.printer.update_item(
130-
"writing", update_messages[next_message])
125+
self.printer.update_item("writing", update_messages[next_message])
131126
next_message += 1
132127
last_update = time.time()
133128
self.printer.mark_item_done("writing")

examples/financial_research_agent/printer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Printer:
1010
Simple wrapper to stream status updates. Used by the financial bot
1111
manager as it orchestrates planning, search and writing.
1212
"""
13+
1314
def __init__(self, console: Console) -> None:
1415
self.live = Live(console=console)
1516
self.items: dict[str, tuple[str, bool]] = {}

tests/voice/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
import sys
3+
4+
import pytest
5+
6+
7+
def pytest_collection_modifyitems(config, items):
8+
if sys.version_info[:2] == (3, 9):
9+
this_dir = os.path.dirname(__file__)
10+
skip_marker = pytest.mark.skip(reason="Skipped on Python 3.9")
11+
12+
for item in items:
13+
if item.fspath.dirname.startswith(this_dir):
14+
item.add_marker(skip_marker)

uv.lock

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)