2121from cleo .io .buffered_io import BufferedIO
2222from cleo .io .outputs .output import Verbosity
2323from poetry .core .packages .package import Package
24- from poetry .core .packages .utils .link import Link
2524from poetry .core .packages .utils .utils import path_to_url
2625
2726from poetry .factory import Factory
@@ -593,11 +592,11 @@ def test_executor_should_delete_incomplete_downloads(
593592 side_effect = Exception ("Download error" ),
594593 )
595594 mocker .patch (
596- "poetry.installation.executor .ArtifactCache.get_cached_archive_for_link " ,
595+ "poetry.utils.cache .ArtifactCache._get_cached_archive " ,
597596 return_value = None ,
598597 )
599598 mocker .patch (
600- "poetry.installation.executor .ArtifactCache.get_cache_directory_for_link" ,
599+ "poetry.utils.cache .ArtifactCache.get_cache_directory_for_link" ,
601600 return_value = tmp_path ,
602601 )
603602
@@ -823,7 +822,7 @@ def test_executor_should_write_pep610_url_references_for_wheel_urls(
823822 if is_artifact_cached :
824823 link_cached = fixture_dir ("distributions" ) / "demo-0.1.0-py2.py3-none-any.whl"
825824 mocker .patch (
826- "poetry.installation.executor .ArtifactCache.get_cached_archive_for_link" ,
825+ "poetry.utils.cache .ArtifactCache.get_cached_archive_for_link" ,
827826 return_value = link_cached ,
828827 )
829828 download_spy = mocker .spy (Executor , "_download_archive" )
@@ -861,9 +860,13 @@ def test_executor_should_write_pep610_url_references_for_wheel_urls(
861860 else :
862861 assert package .source_url is not None
863862 download_spy .assert_called_once_with (
864- mocker .ANY , operation , Link (package .source_url )
863+ mocker .ANY ,
864+ operation ,
865+ package .source_url ,
866+ dest = mocker .ANY ,
865867 )
866- assert download_spy .spy_return .exists (), "cached file should not be deleted"
868+ dest = download_spy .call_args .args [3 ]
869+ assert dest .exists (), "cached file should not be deleted"
867870
868871
869872@pytest .mark .parametrize (
@@ -900,12 +903,12 @@ def test_executor_should_write_pep610_url_references_for_non_wheel_urls(
900903 )
901904 download_spy = mocker .spy (Executor , "_download_archive" )
902905
903- if is_sdist_cached | is_wheel_cached :
906+ if is_sdist_cached or is_wheel_cached :
904907 cached_sdist = fixture_dir ("distributions" ) / "demo-0.1.0.tar.gz"
905908 cached_wheel = fixture_dir ("distributions" ) / "demo-0.1.0-py2.py3-none-any.whl"
906909
907- def mock_get_cached_archive_for_link_func (
908- _ : Link , * , strict : bool , ** __ : Any
910+ def mock_get_cached_archive_func (
911+ _cache_dir : Path , * , strict : bool , ** __ : Any
909912 ) -> Path | None :
910913 if is_wheel_cached and not strict :
911914 return cached_wheel
@@ -914,8 +917,8 @@ def mock_get_cached_archive_for_link_func(
914917 return None
915918
916919 mocker .patch (
917- "poetry.installation.executor .ArtifactCache.get_cached_archive_for_link " ,
918- side_effect = mock_get_cached_archive_for_link_func ,
920+ "poetry.utils.cache .ArtifactCache._get_cached_archive " ,
921+ side_effect = mock_get_cached_archive_func ,
919922 )
920923
921924 package = Package (
@@ -955,9 +958,10 @@ def mock_get_cached_archive_for_link_func(
955958 if expect_artifact_download :
956959 assert package .source_url is not None
957960 download_spy .assert_called_once_with (
958- mocker .ANY , operation , Link ( package .source_url )
961+ mocker .ANY , operation , package .source_url , dest = mocker . ANY
959962 )
960- assert download_spy .spy_return .exists (), "cached file should not be deleted"
963+ dest = download_spy .call_args .args [3 ]
964+ assert dest .exists (), "cached file should not be deleted"
961965 else :
962966 download_spy .assert_not_called ()
963967
@@ -978,7 +982,7 @@ def test_executor_should_write_pep610_url_references_for_git(
978982 if is_artifact_cached :
979983 link_cached = fixture_dir ("distributions" ) / "demo-0.1.2-py2.py3-none-any.whl"
980984 mocker .patch (
981- "poetry.installation.executor .ArtifactCache.get_cached_archive_for_git" ,
985+ "poetry.utils.cache .ArtifactCache.get_cached_archive_for_git" ,
982986 return_value = link_cached ,
983987 )
984988 clone_spy = mocker .spy (Git , "clone" )
0 commit comments