mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-28 13:04:47 +00:00
Use create_venv_py312
in pip-uninstall tests (#764)
This commit is contained in:
parent
286145bc7f
commit
ae8c7d11e3
1 changed files with 6 additions and 43 deletions
|
@ -5,9 +5,10 @@ use assert_cmd::prelude::*;
|
||||||
use assert_fs::prelude::*;
|
use assert_fs::prelude::*;
|
||||||
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};
|
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};
|
||||||
|
|
||||||
use crate::common::create_venv_py312;
|
|
||||||
use common::{BIN_NAME, INSTA_FILTERS};
|
use common::{BIN_NAME, INSTA_FILTERS};
|
||||||
|
|
||||||
|
use crate::common::create_venv_py312;
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -221,17 +222,7 @@ dependencies = ["flask==1.0.x"]
|
||||||
fn uninstall() -> Result<()> {
|
fn uninstall() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
let cache_dir = assert_fs::TempDir::new()?;
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = create_venv_py312(&temp_dir, &cache_dir);
|
||||||
|
|
||||||
Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
|
||||||
.arg(venv.as_os_str())
|
|
||||||
.arg("--cache-dir")
|
|
||||||
.arg(cache_dir.path())
|
|
||||||
.current_dir(&temp_dir)
|
|
||||||
.assert()
|
|
||||||
.success();
|
|
||||||
venv.assert(predicates::path::is_dir());
|
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = temp_dir.child("requirements.txt");
|
||||||
requirements_txt.touch()?;
|
requirements_txt.touch()?;
|
||||||
|
@ -351,7 +342,7 @@ fn missing_record() -> Result<()> {
|
||||||
fn uninstall_editable_by_name() -> Result<()> {
|
fn uninstall_editable_by_name() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
let cache_dir = assert_fs::TempDir::new()?;
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = create_venv_py312(&temp_dir, &cache_dir);
|
||||||
|
|
||||||
let current_dir = std::env::current_dir()?;
|
let current_dir = std::env::current_dir()?;
|
||||||
let workspace_dir = current_dir.join("..").join("..").canonicalize()?;
|
let workspace_dir = current_dir.join("..").join("..").canonicalize()?;
|
||||||
|
@ -359,16 +350,6 @@ fn uninstall_editable_by_name() -> Result<()> {
|
||||||
let mut filters = INSTA_FILTERS.to_vec();
|
let mut filters = INSTA_FILTERS.to_vec();
|
||||||
filters.push((workspace_dir.to_str().unwrap(), "[WORKSPACE_DIR]"));
|
filters.push((workspace_dir.to_str().unwrap(), "[WORKSPACE_DIR]"));
|
||||||
|
|
||||||
Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
|
||||||
.arg(venv.as_os_str())
|
|
||||||
.arg("--cache-dir")
|
|
||||||
.arg(cache_dir.path())
|
|
||||||
.current_dir(&temp_dir)
|
|
||||||
.assert()
|
|
||||||
.success();
|
|
||||||
venv.assert(predicates::path::is_dir());
|
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = temp_dir.child("requirements.txt");
|
||||||
requirements_txt.touch()?;
|
requirements_txt.touch()?;
|
||||||
requirements_txt.write_str("-e ../../scripts/editable-installs/poetry_editable")?;
|
requirements_txt.write_str("-e ../../scripts/editable-installs/poetry_editable")?;
|
||||||
|
@ -422,7 +403,7 @@ fn uninstall_editable_by_name() -> Result<()> {
|
||||||
fn uninstall_editable_by_path() -> Result<()> {
|
fn uninstall_editable_by_path() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
let cache_dir = assert_fs::TempDir::new()?;
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = create_venv_py312(&temp_dir, &cache_dir);
|
||||||
|
|
||||||
let current_dir = std::env::current_dir()?;
|
let current_dir = std::env::current_dir()?;
|
||||||
let workspace_dir = current_dir.join("..").join("..").canonicalize()?;
|
let workspace_dir = current_dir.join("..").join("..").canonicalize()?;
|
||||||
|
@ -430,15 +411,6 @@ fn uninstall_editable_by_path() -> Result<()> {
|
||||||
let mut filters = INSTA_FILTERS.to_vec();
|
let mut filters = INSTA_FILTERS.to_vec();
|
||||||
filters.push((workspace_dir.to_str().unwrap(), "[WORKSPACE_DIR]"));
|
filters.push((workspace_dir.to_str().unwrap(), "[WORKSPACE_DIR]"));
|
||||||
|
|
||||||
Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
|
||||||
.arg(venv.as_os_str())
|
|
||||||
.arg("--cache-dir")
|
|
||||||
.arg(cache_dir.path())
|
|
||||||
.assert()
|
|
||||||
.success();
|
|
||||||
venv.assert(predicates::path::is_dir());
|
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = temp_dir.child("requirements.txt");
|
||||||
requirements_txt.touch()?;
|
requirements_txt.touch()?;
|
||||||
requirements_txt.write_str("-e ../../scripts/editable-installs/poetry_editable")?;
|
requirements_txt.write_str("-e ../../scripts/editable-installs/poetry_editable")?;
|
||||||
|
@ -492,7 +464,7 @@ fn uninstall_editable_by_path() -> Result<()> {
|
||||||
fn uninstall_duplicate_editable() -> Result<()> {
|
fn uninstall_duplicate_editable() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
let cache_dir = assert_fs::TempDir::new()?;
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = create_venv_py312(&temp_dir, &cache_dir);
|
||||||
|
|
||||||
let current_dir = std::env::current_dir()?;
|
let current_dir = std::env::current_dir()?;
|
||||||
let workspace_dir = current_dir.join("..").join("..").canonicalize()?;
|
let workspace_dir = current_dir.join("..").join("..").canonicalize()?;
|
||||||
|
@ -500,15 +472,6 @@ fn uninstall_duplicate_editable() -> Result<()> {
|
||||||
let mut filters = INSTA_FILTERS.to_vec();
|
let mut filters = INSTA_FILTERS.to_vec();
|
||||||
filters.push((workspace_dir.to_str().unwrap(), "[WORKSPACE_DIR]"));
|
filters.push((workspace_dir.to_str().unwrap(), "[WORKSPACE_DIR]"));
|
||||||
|
|
||||||
Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
|
||||||
.arg(venv.as_os_str())
|
|
||||||
.arg("--cache-dir")
|
|
||||||
.arg(cache_dir.path())
|
|
||||||
.assert()
|
|
||||||
.success();
|
|
||||||
venv.assert(predicates::path::is_dir());
|
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = temp_dir.child("requirements.txt");
|
||||||
requirements_txt.touch()?;
|
requirements_txt.touch()?;
|
||||||
requirements_txt.write_str("-e ../../scripts/editable-installs/poetry_editable")?;
|
requirements_txt.write_str("-e ../../scripts/editable-installs/poetry_editable")?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue