Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cachetools = ">=5.2.0,<6.0.0"
cyclonedx-python-lib = ">=6.0.0,<8.0.0"
packageurl-python = ">=0.11.1,<0.14.0"
click = ">=8.1.0,<9.0.0"
aiohttp = ">=3.8.0,<3.14.0"
aiohttp = ">=3.8.0,<4.0.0"
aiodns = ">=3.0.0,<4.0.0"
aiomultiprocess = ">=0.9.0,<0.10.0"
schema = "<=0.7.5"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def run(self) -> None:
"cyclonedx-python-lib<8.0.0,>=6.0.0",
"packageurl-python<0.14.0,>=0.11.1",
"click<9.0.0,>=8.1.0",
"aiohttp<3.14.0,>=3.8.0",
"aiohttp<4.0.0,>=3.8.0",
"aiodns<4.0.0,>=3.0.0",
"aiomultiprocess>=0.9.0,<0.10.0",
"schema<=0.7.5",
Expand Down
16 changes: 16 additions & 0 deletions tests/common/utils/test_http_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
import pytest
from pytest_mock import MockerFixture
from aioresponses import aioresponses
from aioresponses import __version__ as aioresponses_version
import aiohttp

from packaging import version

from checkov.common.util.http_utils import request_wrapper, aiohttp_client_session_wrapper, valid_url

# aioresponses can't build a mock response for aiohttp>=3.14 yet (its mocked
# ClientResponse is missing the new required 'stream_writer' argument), see
# https://github.com/pnuckowski/aioresponses/issues/289. Tests that only mock
# exceptions are unaffected. Remove once aioresponses releases a fix.
AIORESPONSES_LACKS_AIOHTTP_314_SUPPORT = (
version.parse(aiohttp.__version__) >= version.parse("3.14.0")
and version.parse(aioresponses_version) <= version.parse("0.7.8")
)


def get_report_url() -> str:
base_url = "https://www.bridgecrew.cloud/api/v1/vulnerabilities"
Expand Down Expand Up @@ -127,6 +139,10 @@ def test_request_wrapper_with_success_for_post_scan(mock_bc_integration, scan_re
responses.assert_call_count(mock_url, 1)


@pytest.mark.skipif(
AIORESPONSES_LACKS_AIOHTTP_314_SUPPORT,
reason="aioresponses can't mock a successful response under aiohttp>=3.14 (pnuckowski/aioresponses#289)",
)
@pytest.mark.asyncio
async def test_aiohttp_client_session_wrapper_with_one_handled_exception(mocker: MockerFixture, mock_bc_integration):
# given
Expand Down