Repository navigation
Fix relative indexes in scrolls #21097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also updated this test to use the index path relative to the script directory |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -815,6 +815,60 @@ fn run_pep723_script_index() -> Result<()> { | |
| Ok(()) | ||
| } | ||
|
|
||
| /// Run a PEP 723-compatible script with a relative `[[tool.uv.index]]` from another directory. | ||
| #[test] | ||
| fn run_pep723_script_relative_index_from_another_directory() -> Result<()> { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: |
||
| let context = uv_test::test_context!("3.12"); | ||
|
|
||
| let scripts = context.temp_dir.child("scripts"); | ||
| let links = scripts.child("links"); | ||
| links.create_dir_all()?; | ||
| fs_err::copy( | ||
| context | ||
| .workspace_root | ||
| .join("test/links/ok-1.0.0-py3-none-any.whl"), | ||
| links.child("ok-1.0.0-py3-none-any.whl"), | ||
| )?; | ||
|
|
||
| let test_script = scripts.child("main.py"); | ||
| test_script.write_str(indoc! { r#" | ||
| # /// script | ||
| # requires-python = ">=3.11" | ||
| # dependencies = ["ok"] | ||
| # | ||
| # [[tool.uv.index]] | ||
| # name = "local" | ||
| # url = "./links" | ||
| # format = "flat" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the index isn't marked |
||
| # | ||
| # [tool.uv.sources] | ||
| # ok = { index = "local" } | ||
| # /// | ||
|
|
||
| import ok | ||
|
|
||
| print("ok imported") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't necessary, we assert on the success of the exit, so we know things imported fine (we do this same pattern elsewhere). |
||
| "# | ||
| })?; | ||
|
|
||
| let elsewhere = context.temp_dir.child("elsewhere"); | ||
| elsewhere.create_dir_all()?; | ||
|
|
||
| uv_snapshot!(context.filters(), context.run().current_dir(elsewhere).arg("--offline").arg(test_script.path()), @r" | ||
| exit_code: 0 (success) | ||
| ----- stdout ----- | ||
| ok imported | ||
|
|
||
| ----- stderr ----- | ||
| Resolved 1 package in [TIME] | ||
| Prepared 1 package in [TIME] | ||
| Installed 1 package in [TIME] | ||
| + ok==1.0.0 | ||
| "); | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| /// Package-scoped source disabling must not discard unrelated script sources or indexes. | ||
| #[test] | ||
| fn run_pep723_script_no_sources_package() -> Result<()> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be an
.expect("script path has no parent")(as elsewhere in this file).