33from pathlib import Path
44
55from deploy .links import make_links
6- from deploy .config import Config
76
87
98@pytest .fixture
@@ -25,47 +24,41 @@ def _setup_env(tmp_path, base_config):
2524
2625def test_make_links (tmp_path , base_config ):
2726 _setup_env (tmp_path , base_config )
28- config = Config .model_validate (base_config )
29- make_links (config , prefix = tmp_path )
27+ make_links (base_config ["links" ], prefix = tmp_path )
3028 assert (tmp_path / "location/symlink" ).exists ()
3129
3230
3331def test_make_links_fail_missing_target (tmp_path , base_config ):
34- # Note the lack of setting up environment, hence no target file exists
35- config = Config .model_validate (base_config )
3632 with pytest .raises (FileNotFoundError , match = "No such file or directory: 'target'" ):
37- make_links (config , prefix = tmp_path )
33+ make_links (base_config [ "links" ] , prefix = tmp_path )
3834
3935
4036def test_make_links_on_new_package_resolves_latest (tmp_path , base_config ):
4137 base_config ["links" ] = {"location" : {"cool" : "^" }}
42- config = Config .model_validate (base_config )
4338
4439 (tmp_path / "location" / "1.0.0" ).mkdir (parents = True )
4540 (tmp_path / "location" / "1.0.1" ).mkdir (parents = True )
4641
47- make_links (config , prefix = tmp_path )
42+ make_links (base_config [ "links" ] , prefix = tmp_path )
4843 assert os .path .islink (tmp_path / "location/cool" )
4944 assert os .path .realpath (tmp_path / "location/cool" ) == str (
5045 (tmp_path / "location" / "1.0.1" )
5146 )
5247
53- # Lets create a new version
5448 (tmp_path / "location" / "1.0.2" ).mkdir (parents = True )
55- make_links (config , prefix = tmp_path )
49+ make_links (base_config [ "links" ] , prefix = tmp_path )
5650 assert os .path .realpath (tmp_path / "location/cool" ) == str (
5751 (tmp_path / "location" / "1.0.2" )
5852 )
5953
6054
6155def test_some (tmp_path , base_config ):
6256 base_config ["links" ] = {"location" : {"1.0" : "1.0.1" }}
63- config = Config .model_validate (base_config )
6457
6558 (tmp_path / "location" / "1.0.0" ).mkdir (parents = True )
6659 (tmp_path / "location" / "1.0.1" ).mkdir (parents = True )
6760
68- make_links (config , prefix = tmp_path )
61+ make_links (base_config [ "links" ] , prefix = tmp_path )
6962 assert os .path .islink (tmp_path / "location/1.0" )
7063 assert os .path .realpath (tmp_path / "location/1.0" ) == str (
7164 (tmp_path / "location" / "1.0.1" )
0 commit comments