Skip to content

Commit f9af7ef

Browse files
committed
Use real Response in test_operations_prepare
1 parent f0fce92 commit f9af7ef

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/unit/test_operations_prepare.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44
from shutil import rmtree
55
from tempfile import mkdtemp
6-
from typing import Any
6+
from typing import TYPE_CHECKING, Any
77
from unittest.mock import Mock, patch
88

99
import pytest
@@ -18,14 +18,19 @@
1818
from tests.lib import TestData
1919
from tests.lib.requests_mocks import MockResponse
2020

21+
if TYPE_CHECKING:
22+
from requests.models import Response
23+
else:
24+
from pip._vendor.requests.models import Response
25+
2126

2227
def test_unpack_url_with_urllib_response_without_content_type(data: TestData) -> None:
2328
"""
2429
It should download and unpack files even if no Content-Type header exists
2530
"""
2631
_real_session = PipSession()
2732

28-
def _fake_session_get(*args: Any, **kwargs: Any) -> dict[str, str]:
33+
def _fake_session_get(*args: Any, **kwargs: Any) -> Response:
2934
resp = _real_session.get(*args, **kwargs)
3035
del resp.headers["Content-Type"]
3136
return resp

0 commit comments

Comments
 (0)