@@ -3064,7 +3064,7 @@ fn add_path_adjacent_directory() -> Result<()> {
30643064 ]
30653065
30663066 [tool.uv.sources]
3067- dependency = { path = "[TEMP_DIR] /dependency" }
3067+ dependency = { path = ".. /dependency" }
30683068 "#
30693069 ) ;
30703070 } ) ;
@@ -3087,7 +3087,7 @@ fn add_path_adjacent_directory() -> Result<()> {
30873087 [[package]]
30883088 name = "dependency"
30893089 version = "0.1.0"
3090- source = { directory = "[TEMP_DIR] /dependency" }
3090+ source = { directory = ".. /dependency" }
30913091
30923092 [[package]]
30933093 name = "project"
@@ -3098,7 +3098,7 @@ fn add_path_adjacent_directory() -> Result<()> {
30983098 ]
30993099
31003100 [package.metadata]
3101- requires-dist = [{ name = "dependency", directory = "[TEMP_DIR] /dependency" }]
3101+ requires-dist = [{ name = "dependency", directory = ".. /dependency" }]
31023102 "#
31033103 ) ;
31043104 } ) ;
@@ -3108,10 +3108,7 @@ fn add_path_adjacent_directory() -> Result<()> {
31083108
31093109/// Check relative and absolute path handling with `uv add`.
31103110///
3111- /// When a user provides an absolute path or `file://` URL, it should be preserved as absolute
3112- /// in pyproject.toml and uv.lock. Relative paths should remain relative.
3113- ///
3114- /// See: <https://github.com/astral-sh/uv/issues/17307>
3111+ /// BUG: Currently `uv add` always relativizes paths in `pyproject.toml`
31153112#[ test]
31163113fn add_relative_and_absolute_paths ( ) -> Result < ( ) > {
31173114 let context = uv_test:: test_context!( "3.12" ) ;
@@ -3224,8 +3221,7 @@ fn add_relative_and_absolute_paths() -> Result<()> {
32243221 + file-url-dep==0.1.0 (from file://[TEMP_DIR]/file_url_dep)
32253222 " ) ;
32263223
3227- // Check pyproject.toml - relative paths stay relative, absolute paths and file:// URLs
3228- // stay absolute.
3224+ // Check pyproject.toml.
32293225 let pyproject_toml = fs_err:: read_to_string ( project. join ( "pyproject.toml" ) ) ?;
32303226
32313227 insta:: with_settings!( {
@@ -3245,13 +3241,13 @@ fn add_relative_and_absolute_paths() -> Result<()> {
32453241
32463242 [tool.uv.sources]
32473243 relative-dep = { path = "../relative_dep" }
3248- absolute-dep = { path = "[TEMP_DIR] /absolute_dep" }
3249- file-url-dep = { path = "[TEMP_DIR] /file_url_dep" }
3244+ absolute-dep = { path = ".. /absolute_dep" }
3245+ file-url-dep = { path = ".. /file_url_dep" }
32503246 "#
32513247 ) ;
32523248 } ) ;
32533249
3254- // Check uv.lock - relative paths stay relative, absolute paths stay absolute .
3250+ // Check uv.lock.
32553251 let lock = fs_err:: read_to_string ( project. join ( "uv.lock" ) ) ?;
32563252
32573253 insta:: with_settings!( {
@@ -3269,12 +3265,12 @@ fn add_relative_and_absolute_paths() -> Result<()> {
32693265 [[package]]
32703266 name = "absolute-dep"
32713267 version = "0.1.0"
3272- source = { directory = "[TEMP_DIR] /absolute_dep" }
3268+ source = { directory = ".. /absolute_dep" }
32733269
32743270 [[package]]
32753271 name = "file-url-dep"
32763272 version = "0.1.0"
3277- source = { directory = "[TEMP_DIR] /file_url_dep" }
3273+ source = { directory = ".. /file_url_dep" }
32783274
32793275 [[package]]
32803276 name = "project"
@@ -3288,8 +3284,8 @@ fn add_relative_and_absolute_paths() -> Result<()> {
32883284
32893285 [package.metadata]
32903286 requires-dist = [
3291- { name = "absolute-dep", directory = "[TEMP_DIR] /absolute_dep" },
3292- { name = "file-url-dep", directory = "[TEMP_DIR] /file_url_dep" },
3287+ { name = "absolute-dep", directory = ".. /absolute_dep" },
3288+ { name = "file-url-dep", directory = ".. /file_url_dep" },
32933289 { name = "relative-dep", directory = "../relative_dep" },
32943290 ]
32953291
0 commit comments