Skip to content

Commit 290f385

Browse files
authored
test: Skip flaky tests (#1661)
- #1649 - #1650 - #1651 - #1652 - #1655 - #1660
1 parent 1a22548 commit 290f385

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

tests/unit/_autoscaling/test_autoscaled_pool.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import asyncio
6+
import sys
67
from contextlib import suppress
78
from datetime import datetime, timedelta, timezone
89
from itertools import chain, repeat
@@ -144,6 +145,10 @@ async def run() -> None:
144145
await pool.run()
145146

146147

148+
@pytest.mark.skipif(
149+
sys.platform != 'linux',
150+
reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1655.',
151+
)
147152
async def test_autoscales(
148153
monkeypatch: pytest.MonkeyPatch,
149154
system_status: SystemStatus | Mock,

tests/unit/browsers/test_browser_pool.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import sys
34
from typing import TYPE_CHECKING
45

56
import pytest
@@ -62,6 +63,10 @@ async def test_multiple_plugins_new_page_creation(server_url: URL) -> None:
6263
assert browser_pool.total_pages_count == 3
6364

6465

66+
@pytest.mark.skipif(
67+
sys.platform != 'linux',
68+
reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1660.',
69+
)
6570
async def test_new_page_with_each_plugin(server_url: URL) -> None:
6671
plugin_chromium = PlaywrightBrowserPlugin(browser_type='chromium')
6772
plugin_firefox = PlaywrightBrowserPlugin(browser_type='firefox')

tests/unit/crawlers/_adaptive_playwright/test_adaptive_playwright_crawler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import asyncio
44
import logging
5+
import sys
56
from dataclasses import dataclass
67
from datetime import timedelta
78
from itertools import cycle
@@ -604,6 +605,10 @@ async def request_handler(context: AdaptivePlaywrightCrawlingContext) -> None:
604605
mocked_h2_handler.assert_has_calls([call(expected_h2_tag)])
605606

606607

608+
@pytest.mark.skipif(
609+
sys.platform != 'linux',
610+
reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1650.',
611+
)
607612
async def test_adaptive_context_query_selector_parsel(test_urls: list[str]) -> None:
608613
"""Test that `context.query_selector_one` works regardless of the crawl type for Parsel variant.
609614

tests/unit/crawlers/_basic/test_basic_crawler.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,10 @@ async def handler(context: BasicCrawlingContext) -> None:
13021302

13031303

13041304
@pytest.mark.run_alone
1305+
@pytest.mark.skipif(
1306+
sys.platform != 'linux',
1307+
reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1652.',
1308+
)
13051309
@pytest.mark.skipif(sys.version_info[:3] < (3, 11), reason='asyncio.timeout was introduced in Python 3.11.')
13061310
@pytest.mark.parametrize(
13071311
'sleep_type',
@@ -1351,6 +1355,10 @@ async def handler(context: BasicCrawlingContext) -> None:
13511355
assert mocked_handler_after_sleep.call_count == 1
13521356

13531357

1358+
@pytest.mark.skipif(
1359+
sys.platform != 'linux',
1360+
reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1649.',
1361+
)
13541362
@pytest.mark.parametrize(
13551363
('keep_alive', 'max_requests_per_crawl', 'expected_handled_requests_count'),
13561364
[

tests/unit/crawlers/_playwright/test_playwright_crawler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import asyncio
88
import json
99
import logging
10+
import sys
1011
from datetime import timedelta
1112
from typing import TYPE_CHECKING, Any, Literal
1213
from unittest import mock
@@ -325,6 +326,10 @@ async def some_hook(context: PlaywrightPreNavCrawlingContext) -> None:
325326
assert handler_data.get('proxy') == proxy_value
326327

327328

329+
@pytest.mark.skipif(
330+
sys.platform != 'linux',
331+
reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1651.',
332+
)
328333
@pytest.mark.parametrize(
329334
'use_incognito_pages',
330335
[

0 commit comments

Comments
 (0)