@@ -784,6 +784,21 @@ fn run_pep723_script_lock() -> Result<()> {
784784 "#
785785 } ) ?;
786786
787+ // Without a lockfile, running with `--locked` should warn.
788+ uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "--locked" ) . arg( "main.py" ) , @r###"
789+ success: true
790+ exit_code: 0
791+ ----- stdout -----
792+ Hello, world!
793+
794+ ----- stderr -----
795+ warning: No lockfile found for Python script (ignoring `--locked`); run `uv lock --script` to generate a lockfile
796+ Resolved 1 package in [TIME]
797+ Prepared 1 package in [TIME]
798+ Installed 1 package in [TIME]
799+ + iniconfig==2.0.0
800+ "### ) ;
801+
787802 // Explicitly lock the script.
788803 uv_snapshot ! ( context. filters( ) , context. lock( ) . arg( "--script" ) . arg( "main.py" ) , @r###"
789804 success: true
@@ -822,6 +837,7 @@ fn run_pep723_script_lock() -> Result<()> {
822837 ) ;
823838 } ) ;
824839
840+ // Run the script.
825841 uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "main.py" ) , @r###"
826842 success: true
827843 exit_code: 0
@@ -830,11 +846,21 @@ fn run_pep723_script_lock() -> Result<()> {
830846
831847 ----- stderr -----
832848 Resolved 1 package in [TIME]
833- Prepared 1 package in [TIME]
834849 Installed 1 package in [TIME]
835850 + iniconfig==2.0.0
836851 "### ) ;
837852
853+ // With a lockfile, running with `--locked` should not warn.
854+ uv_snapshot ! ( context. filters( ) , context. run( ) . arg( "--locked" ) . arg( "main.py" ) , @r###"
855+ success: true
856+ exit_code: 0
857+ ----- stdout -----
858+ Hello, world!
859+
860+ ----- stderr -----
861+ Resolved 1 package in [TIME]
862+ "### ) ;
863+
838864 // Modify the metadata.
839865 test_script. write_str ( indoc ! { r#"
840866 # /// script
@@ -868,7 +894,6 @@ fn run_pep723_script_lock() -> Result<()> {
868894 ----- stdout -----
869895
870896 ----- stderr -----
871- warning: `--frozen` is a no-op for Python scripts with inline metadata, which always run in isolation
872897 Traceback (most recent call last):
873898 File "[TEMP_DIR]/main.py", line 8, in <module>
874899 import anyio
0 commit comments