Skip to content

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

fix(tests): remove unused imports and fix formatting

ShawnPanae34ee5898eed
diff --git a/tests/ci/test_doctor_command.py b/tests/ci/test_doctor_command.py
index 3b07f9f6b..eeec1164e 100644
--- a/tests/ci/test_doctor_command.py
+++ b/tests/ci/test_doctor_command.py
@@ -50,7 +50,6 @@ async def test_doctor_issues():
def test_check_package_installed():
"""Test _check_package when installed."""
- import browser_use
result = doctor._check_package()
assert result['status'] == 'ok'
diff --git a/tests/ci/test_install_config.py b/tests/ci/test_install_config.py
index 9c86883de..02b389e1e 100644
--- a/tests/ci/test_install_config.py
+++ b/tests/ci/test_install_config.py
@@ -1,7 +1,6 @@
"""Tests for install configuration module."""
import json
-import tempfile
from pathlib import Path
from unittest.mock import patch
@@ -35,9 +34,7 @@ class TestInstallConfig:
# Create config file with remote-only mode
temp_config_dir.parent.mkdir(parents=True, exist_ok=True)
- temp_config_dir.write_text(
- json.dumps({'installed_modes': ['remote'], 'default_mode': 'remote'})
- )
+ temp_config_dir.write_text(json.dumps({'installed_modes': ['remote'], 'default_mode': 'remote'}))
config = get_config()
assert config['installed_modes'] == ['remote']
diff --git a/tests/ci/test_session_browser_mode.py b/tests/ci/test_session_browser_mode.py
index 0bc26ddf5..40c72d97a 100644
--- a/tests/ci/test_session_browser_mode.py
+++ b/tests/ci/test_session_browser_mode.py
@@ -7,9 +7,6 @@ subsequent commands with a different mode should error with helpful guidance.
import json
import tempfile
from pathlib import Path
-from unittest.mock import patch
-
-import pytest
from browser_use.skill_cli.main import get_session_metadata_path
@@ -33,11 +30,13 @@ def test_metadata_file_format():
try:
# Write metadata as the code does
meta_path.write_text(
- json.dumps({
- 'browser_mode': 'chromium',
- 'headed': False,
- 'profile': None,
- })
+ json.dumps(
+ {
+ 'browser_mode': 'chromium',
+ 'headed': False,
+ 'profile': None,
+ }
+ )
)
# Read and verify
@@ -55,11 +54,13 @@ def test_metadata_file_remote_mode():
meta_path = get_session_metadata_path('test-remote')
try:
meta_path.write_text(
- json.dumps({
- 'browser_mode': 'remote',
- 'headed': True,
- 'profile': 'cloud-profile-123',
- })
+ json.dumps(
+ {
+ 'browser_mode': 'remote',
+ 'headed': True,
+ 'profile': 'cloud-profile-123',
+ }
+ )
)
meta = json.loads(meta_path.read_text())
diff --git a/tests/ci/test_setup_command.py b/tests/ci/test_setup_command.py
index 6577450dc..e9aa2676c 100644
--- a/tests/ci/test_setup_command.py
+++ b/tests/ci/test_setup_command.py
@@ -4,8 +4,6 @@ These tests call real functions without mocking. They verify the
structure and logic of the setup command against actual system state.
"""
-import pytest
-
from browser_use.skill_cli.commands import setup