mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Use isolated Poetry editables for pip_uninstall
tests
This commit is contained in:
parent
8352560b98
commit
eefe7df1bf
1 changed files with 24 additions and 18 deletions
|
@ -5,6 +5,8 @@ use assert_cmd::prelude::*;
|
|||
use assert_fs::fixture::ChildPath;
|
||||
use assert_fs::prelude::*;
|
||||
|
||||
use uv_fs::copy_dir_all;
|
||||
|
||||
use crate::common::{TestContext, get_bin, uv_snapshot};
|
||||
|
||||
#[test]
|
||||
|
@ -211,17 +213,19 @@ fn uninstall_editable_by_name() -> Result<()> {
|
|||
#[cfg(feature = "pypi")]
|
||||
fn uninstall_by_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let poetry_editable = context.temp_dir.child("packages").child("poetry_editable");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(
|
||||
// Copy into the temporary directory.
|
||||
copy_dir_all(
|
||||
context
|
||||
.workspace_root
|
||||
.join("scripts/packages/poetry_editable")
|
||||
.as_os_str()
|
||||
.to_str()
|
||||
.expect("Path is valid unicode"),
|
||||
.join("scripts/packages/poetry_editable"),
|
||||
&poetry_editable,
|
||||
)?;
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(poetry_editable.as_os_str().to_str().unwrap())?;
|
||||
|
||||
context
|
||||
.pip_sync()
|
||||
.arg(requirements_txt.path())
|
||||
|
@ -232,15 +236,15 @@ fn uninstall_by_path() -> Result<()> {
|
|||
|
||||
// Uninstall the editable by path.
|
||||
uv_snapshot!(context.filters(), context.pip_uninstall()
|
||||
.arg(context.workspace_root.join("scripts/packages/poetry_editable")), @r###"
|
||||
.arg(poetry_editable.as_os_str()), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Uninstalled 1 package in [TIME]
|
||||
- poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable)
|
||||
"###
|
||||
- poetry-editable==0.1.0 (from file://[TEMP_DIR]/poetry_editable)
|
||||
"
|
||||
);
|
||||
|
||||
context.assert_command("import poetry_editable").failure();
|
||||
|
@ -252,17 +256,19 @@ fn uninstall_by_path() -> Result<()> {
|
|||
#[cfg(feature = "pypi")]
|
||||
fn uninstall_duplicate_by_path() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let poetry_editable = context.temp_dir.child("packages").child("poetry_editable");
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(
|
||||
// Copy into the temporary directory.
|
||||
copy_dir_all(
|
||||
context
|
||||
.workspace_root
|
||||
.join("scripts/packages/poetry_editable")
|
||||
.as_os_str()
|
||||
.to_str()
|
||||
.expect("Path is valid unicode"),
|
||||
.join("scripts/packages/poetry_editable"),
|
||||
&poetry_editable,
|
||||
)?;
|
||||
|
||||
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||
requirements_txt.write_str(poetry_editable.as_os_str().to_str().unwrap())?;
|
||||
|
||||
context
|
||||
.pip_sync()
|
||||
.arg(requirements_txt.path())
|
||||
|
@ -274,15 +280,15 @@ fn uninstall_duplicate_by_path() -> Result<()> {
|
|||
// Uninstall the editable by both path and name.
|
||||
uv_snapshot!(context.filters(), context.pip_uninstall()
|
||||
.arg("poetry-editable")
|
||||
.arg(context.workspace_root.join("scripts/packages/poetry_editable")), @r###"
|
||||
.arg(poetry_editable.as_os_str()), @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Uninstalled 1 package in [TIME]
|
||||
- poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable)
|
||||
"###
|
||||
- poetry-editable==0.1.0 (from file://[TEMP_DIR]/poetry_editable)
|
||||
"
|
||||
);
|
||||
|
||||
context.assert_command("import poetry_editable").failure();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue