diff --git a/tests/unit/_autoscaling/test_autoscaled_pool.py b/tests/unit/_autoscaling/test_autoscaled_pool.py index fbe26319d8..645cd12cdd 100644 --- a/tests/unit/_autoscaling/test_autoscaled_pool.py +++ b/tests/unit/_autoscaling/test_autoscaled_pool.py @@ -3,6 +3,7 @@ from __future__ import annotations import asyncio +import sys from contextlib import suppress from datetime import datetime, timedelta, timezone from itertools import chain, repeat @@ -144,6 +145,10 @@ async def run() -> None: await pool.run() +@pytest.mark.skipif( + sys.platform != 'linux', + reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1655.', +) async def test_autoscales( monkeypatch: pytest.MonkeyPatch, system_status: SystemStatus | Mock, diff --git a/tests/unit/browsers/test_browser_pool.py b/tests/unit/browsers/test_browser_pool.py index 630db92872..2c38d3b601 100644 --- a/tests/unit/browsers/test_browser_pool.py +++ b/tests/unit/browsers/test_browser_pool.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys from typing import TYPE_CHECKING import pytest @@ -62,6 +63,10 @@ async def test_multiple_plugins_new_page_creation(server_url: URL) -> None: assert browser_pool.total_pages_count == 3 +@pytest.mark.skipif( + sys.platform != 'linux', + reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1660.', +) async def test_new_page_with_each_plugin(server_url: URL) -> None: plugin_chromium = PlaywrightBrowserPlugin(browser_type='chromium') plugin_firefox = PlaywrightBrowserPlugin(browser_type='firefox') diff --git a/tests/unit/crawlers/_adaptive_playwright/test_adaptive_playwright_crawler.py b/tests/unit/crawlers/_adaptive_playwright/test_adaptive_playwright_crawler.py index c2d0f153b1..8dc686f4c8 100644 --- a/tests/unit/crawlers/_adaptive_playwright/test_adaptive_playwright_crawler.py +++ b/tests/unit/crawlers/_adaptive_playwright/test_adaptive_playwright_crawler.py @@ -2,6 +2,7 @@ import asyncio import logging +import sys from dataclasses import dataclass from datetime import timedelta from itertools import cycle @@ -604,6 +605,10 @@ async def request_handler(context: AdaptivePlaywrightCrawlingContext) -> None: mocked_h2_handler.assert_has_calls([call(expected_h2_tag)]) +@pytest.mark.skipif( + sys.platform != 'linux', + reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1650.', +) async def test_adaptive_context_query_selector_parsel(test_urls: list[str]) -> None: """Test that `context.query_selector_one` works regardless of the crawl type for Parsel variant. diff --git a/tests/unit/crawlers/_basic/test_basic_crawler.py b/tests/unit/crawlers/_basic/test_basic_crawler.py index d4ac09ff85..bc5618c439 100644 --- a/tests/unit/crawlers/_basic/test_basic_crawler.py +++ b/tests/unit/crawlers/_basic/test_basic_crawler.py @@ -1302,6 +1302,10 @@ async def handler(context: BasicCrawlingContext) -> None: @pytest.mark.run_alone +@pytest.mark.skipif( + sys.platform != 'linux', + reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1652.', +) @pytest.mark.skipif(sys.version_info[:3] < (3, 11), reason='asyncio.timeout was introduced in Python 3.11.') @pytest.mark.parametrize( 'sleep_type', @@ -1351,6 +1355,10 @@ async def handler(context: BasicCrawlingContext) -> None: assert mocked_handler_after_sleep.call_count == 1 +@pytest.mark.skipif( + sys.platform != 'linux', + reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1649.', +) @pytest.mark.parametrize( ('keep_alive', 'max_requests_per_crawl', 'expected_handled_requests_count'), [ diff --git a/tests/unit/crawlers/_playwright/test_playwright_crawler.py b/tests/unit/crawlers/_playwright/test_playwright_crawler.py index 134f699161..1ecdb8859b 100644 --- a/tests/unit/crawlers/_playwright/test_playwright_crawler.py +++ b/tests/unit/crawlers/_playwright/test_playwright_crawler.py @@ -7,6 +7,7 @@ import asyncio import json import logging +import sys from datetime import timedelta from typing import TYPE_CHECKING, Any, Literal from unittest import mock @@ -325,6 +326,10 @@ async def some_hook(context: PlaywrightPreNavCrawlingContext) -> None: assert handler_data.get('proxy') == proxy_value +@pytest.mark.skipif( + sys.platform != 'linux', + reason='Test is flaky on Windows and MacOS, see https://github.com/apify/crawlee-python/issues/1651.', +) @pytest.mark.parametrize( 'use_incognito_pages', [