Skip to content

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

fix function-scope runloop

Nick Sweetingae3d47b19258
diff --git a/tests/ci/test_browser_session.py b/tests/ci/test_browser_session.py
index 9df55b82d..9f0af6c8f 100644
--- a/tests/ci/test_browser_session.py
+++ b/tests/ci/test_browser_session.py
@@ -11,13 +11,6 @@ from browser_use.dom.views import DOMElementNode
class TestBrowserContext:
"""Tests for browser context functionality using real browser instances."""
- @pytest.fixture(scope='module')
- def event_loop(self):
- """Create and provide an event loop for async tests."""
- loop = asyncio.get_event_loop_policy().new_event_loop()
- yield loop
- loop.close()
-
@pytest.fixture(scope='module')
def http_server(self):
"""Create and provide a test HTTP server that serves static content."""
@@ -61,8 +54,8 @@ class TestBrowserContext:
"""Return the base URL for the test HTTP server."""
return f'http://{http_server.host}:{http_server.port}'
- @pytest.fixture(scope='module')
- async def browser_session(self, event_loop):
+ @pytest.fixture
+ async def browser_session(self):
"""Create and provide a BrowserSession instance with security disabled."""
browser_session = BrowserSession(
# browser_profile=BrowserProfile(...),