|
11 | 11 | import pytest
|
12 | 12 | from pip._internal.utils.hashes import FAVORITE_HASH
|
13 | 13 | from pip._internal.utils.urls import path_to_url
|
| 14 | +from pip._vendor.packaging.version import Version |
14 | 15 |
|
15 | 16 | from piptools.scripts.compile import cli
|
16 |
| -from piptools.utils import COMPILE_EXCLUDE_OPTIONS |
| 17 | +from piptools.utils import ( |
| 18 | + COMPILE_EXCLUDE_OPTIONS, |
| 19 | + get_pip_version_for_python_executable, |
| 20 | +) |
17 | 21 |
|
18 | 22 | from .constants import MINIMAL_WHEELS_PATH, PACKAGES_PATH
|
19 | 23 |
|
@@ -2925,7 +2929,14 @@ def test_pass_pip_cache_to_pip_args(tmpdir, runner, current_resolver):
|
2925 | 2929 | cli, ["--cache-dir", str(cache_dir), "--resolver", current_resolver]
|
2926 | 2930 | )
|
2927 | 2931 | assert out.exit_code == 0
|
2928 |
| - assert os.listdir(os.path.join(str(cache_dir), "http")) |
| 2932 | + # TODO: Remove hack once testing only on v23.3+ |
| 2933 | + pip_current_version = get_pip_version_for_python_executable(sys.executable) |
| 2934 | + pip_breaking_version = Version("23.3.dev0") |
| 2935 | + if pip_current_version >= pip_breaking_version: |
| 2936 | + pip_http_cache_dir = "http-v2" |
| 2937 | + else: |
| 2938 | + pip_http_cache_dir = "http" |
| 2939 | + assert os.listdir(os.path.join(str(cache_dir), pip_http_cache_dir)) |
2929 | 2940 |
|
2930 | 2941 |
|
2931 | 2942 | @backtracking_resolver_only
|
|
0 commit comments