Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Commit 6746079

Browse files
committed
fix: resolve pytest-asyncio compatibility in web tests
1 parent 9eb3132 commit 6746079

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

‎tests/test_web_v1_3.py‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,35 @@
22
import asyncio
33
import sys
44
import os
5+
import pytest
56

67
# Add project root to sys.path
78
sys.path.append(os.getcwd())
89

910
from plexir.tools.definitions import WebSearchTool, BrowseURLTool
1011

11-
async def test_tools():
12-
print("--- Testing WebSearchTool (Fallback) ---")
12+
@pytest.mark.asyncio
13+
async def test_web_search_fallback():
14+
"""Test WebSearchTool fallback (DuckDuckGo)."""
1315
search_tool = WebSearchTool()
1416
results = await search_tool.run("Python programming")
15-
print(f"Results preview:\n{results[:200]}...")
16-
17-
print("\n--- Testing BrowseURLTool (Extraction) ---")
17+
assert "Python" in results
18+
assert "URL:" in results
19+
20+
@pytest.mark.asyncio
21+
async def test_browse_url_extraction():
22+
"""Test BrowseURLTool content extraction."""
1823
browse_tool = BrowseURLTool()
1924
# Test with a known static page
2025
content = await browse_tool.run("https://www.python.org/about/")
21-
print(f"Extracted content length: {len(content)}")
22-
print(f"Content preview:\n{content[:200]}...")
26+
assert len(content) > 500
27+
assert "Python" in content
2328

2429
if __name__ == "__main__":
25-
asyncio.run(test_tools())
30+
# Allow running manually
31+
async def run_manual():
32+
await test_web_search_fallback()
33+
await test_browse_url_extraction()
34+
print("Manual tests passed!")
35+
36+
asyncio.run(run_manual())

0 commit comments

Comments
 (0)