Skip to content

Commit 40d383a

Browse files
committed
Improve test coverage
1 parent ae818d3 commit 40d383a

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

tests/tests_asyncio/test_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
def mock_crawler_with_handlers() -> dict:
31-
handlers = {}
31+
handlers = {"unused": MagicMock()}
3232
for schema, pid in SCHEMA_PID_MAP.items():
3333
process = MagicMock()
3434
process.pid = pid

tests/tests_asyncio/test_provider.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ def test_default_provider_implements_protocol(self):
7171

7272

7373
class TestPlaywrightBrowserProvider(IsolatedAsyncioTestCase):
74+
@allow_windows
75+
async def test_launch_before_start_raises(self):
76+
provider = PlaywrightBrowserProvider(Config.from_settings(Settings({})))
77+
with pytest.raises(
78+
RuntimeError, match="start\\(\\) must be awaited before launch_browser"
79+
):
80+
await provider.launch_browser()
81+
with pytest.raises(
82+
RuntimeError, match="start\\(\\) must be awaited before launch_persistent_context"
83+
):
84+
await provider.launch_persistent_context({})
85+
7486
@allow_windows
7587
async def test_lifecycle(self):
7688
config = Config.from_settings(

0 commit comments

Comments
 (0)