File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,12 @@ impl FilesystemOptions {
170170
171171 /// Load a [`FilesystemOptions`] from a `uv.toml` file.
172172 pub fn from_file ( path : impl AsRef < Path > ) -> Result < Self , Error > {
173- Ok ( Self ( read_file ( path. as_ref ( ) ) ?) )
173+ let path = path. as_ref ( ) ;
174+ tracing:: debug!( "Reading user configuration from: `{}`" , path. display( ) ) ;
175+
176+ let options = read_file ( path) ?;
177+ validate_uv_toml ( path, & options) ?;
178+ Ok ( Self ( options) )
174179 }
175180}
176181
Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ fn invalid_toml_filename() -> Result<()> {
267267}
268268
269269#[ test]
270- fn invalid_uv_toml_option_disallowed ( ) -> Result < ( ) > {
270+ fn invalid_uv_toml_option_disallowed_automatic_discovery ( ) -> Result < ( ) > {
271271 let context = TestContext :: new ( "3.12" ) ;
272272 let uv_toml = context. temp_dir . child ( "uv.toml" ) ;
273273 uv_toml. write_str ( indoc ! { r"
@@ -288,6 +288,30 @@ fn invalid_uv_toml_option_disallowed() -> Result<()> {
288288 Ok ( ( ) )
289289}
290290
291+ #[ test]
292+ fn invalid_uv_toml_option_disallowed_command_line ( ) -> Result < ( ) > {
293+ let context = TestContext :: new ( "3.12" ) ;
294+ let uv_toml = context. temp_dir . child ( "foo.toml" ) ;
295+ uv_toml. write_str ( indoc ! { r"
296+ managed = true
297+ " } ) ?;
298+
299+ uv_snapshot ! ( context. pip_install( )
300+ . arg( "iniconfig" )
301+ . arg( "--config-file" )
302+ . arg( "foo.toml" ) , @r"
303+ success: false
304+ exit_code: 2
305+ ----- stdout -----
306+
307+ ----- stderr -----
308+ error: Failed to parse: `foo.toml`. The `managed` field is not allowed in a `uv.toml` file. `managed` is only applicable in the context of a project, and should be placed in a `pyproject.toml` file instead.
309+ "
310+ ) ;
311+
312+ Ok ( ( ) )
313+ }
314+
291315#[ test]
292316fn cache_uv_toml_credentials ( ) -> Result < ( ) > {
293317 let context = TestContext :: new ( "3.12" ) ;
You can’t perform that action at this time.
0 commit comments