mirror of https://github.com/astral-sh/uv
Refactor remaining integration tests (#1220)
Mostly a mechanical refactor to use the `puffin_snapshot!` and `TestContext` infrastructure in the add, remove, venv and pip uninstall tests, in preparation for adding programmatic windows testing filters. The is only one remaining usage of `assert_cmd_snapshot!` now in the `puffin_snapshot!` macro.
This commit is contained in:
parent
6b050a1972
commit
0925e446a8
|
|
@ -2,8 +2,9 @@ use std::process::Command;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use assert_fs::prelude::*;
|
use assert_fs::prelude::*;
|
||||||
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};
|
use insta_cmd::get_cargo_bin;
|
||||||
|
|
||||||
|
use crate::common::puffin_snapshot;
|
||||||
use common::BIN_NAME;
|
use common::BIN_NAME;
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
@ -13,7 +14,7 @@ fn missing_pyproject_toml() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
let pyproject_toml = temp_dir.child("pyproject.toml");
|
let pyproject_toml = temp_dir.child("pyproject.toml");
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("add")
|
.arg("add")
|
||||||
.arg("flask")
|
.arg("flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -39,7 +40,7 @@ fn missing_project_table() -> Result<()> {
|
||||||
let pyproject_toml = temp_dir.child("pyproject.toml");
|
let pyproject_toml = temp_dir.child("pyproject.toml");
|
||||||
pyproject_toml.touch()?;
|
pyproject_toml.touch()?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("add")
|
.arg("add")
|
||||||
.arg("flask")
|
.arg("flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -72,7 +73,7 @@ name = "project"
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("add")
|
.arg("add")
|
||||||
.arg("flask")
|
.arg("flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -109,7 +110,7 @@ dependencies = [
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("add")
|
.arg("add")
|
||||||
.arg("flask==2.0.0")
|
.arg("flask==2.0.0")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -144,7 +145,7 @@ dependencies = ["flask==1.0.0"]
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("add")
|
.arg("add")
|
||||||
.arg("requests")
|
.arg("requests")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
|
||||||
|
|
@ -111,11 +111,11 @@ pub fn create_venv(temp_dir: &TempDir, cache_dir: &TempDir, python: &str) -> Pat
|
||||||
venv.to_path_buf()
|
venv.to_path_buf()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run [`assert_cmd_snapshot!`] with our default filters.
|
/// Run [`assert_cmd_snapshot!`], with default filters or with custom filters.
|
||||||
#[allow(unused_macros)]
|
#[allow(unused_macros)]
|
||||||
macro_rules! puffin_snapshot {
|
macro_rules! puffin_snapshot {
|
||||||
($spawnable:expr, @$snapshot:literal) => {{
|
($spawnable:expr, @$snapshot:literal) => {{
|
||||||
puffin_snapshot!(INSTA_FILTERS.to_vec(), $spawnable, @$snapshot);
|
puffin_snapshot!($crate::common::INSTA_FILTERS.to_vec(), $spawnable, @$snapshot);
|
||||||
}};
|
}};
|
||||||
($filters:expr, $spawnable:expr, @$snapshot:literal) => {{
|
($filters:expr, $spawnable:expr, @$snapshot:literal) => {{
|
||||||
::insta::with_settings!({
|
::insta::with_settings!({
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ use std::process::Command;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use assert_cmd::prelude::*;
|
use assert_cmd::prelude::*;
|
||||||
use assert_fs::prelude::*;
|
use assert_fs::prelude::*;
|
||||||
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};
|
use insta_cmd::get_cargo_bin;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use common::{BIN_NAME, INSTA_FILTERS};
|
use common::{puffin_snapshot, BIN_NAME, INSTA_FILTERS};
|
||||||
use puffin_fs::NormalizedDisplay;
|
use puffin_fs::NormalizedDisplay;
|
||||||
|
|
||||||
use crate::common::{create_venv, venv_to_interpreter};
|
use crate::common::{venv_to_interpreter, TestContext};
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
|
|
@ -18,10 +18,7 @@ mod common;
|
||||||
fn no_arguments() -> Result<()> {
|
fn no_arguments() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
|
|
||||||
insta::with_settings!({
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
filters => INSTA_FILTERS.to_vec()
|
|
||||||
}, {
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -36,8 +33,8 @@ fn no_arguments() -> Result<()> {
|
||||||
Usage: puffin pip uninstall <PACKAGE|--requirement <REQUIREMENT>|--editable <EDITABLE>>
|
Usage: puffin pip uninstall <PACKAGE|--requirement <REQUIREMENT>|--editable <EDITABLE>>
|
||||||
|
|
||||||
For more information, try '--help'.
|
For more information, try '--help'.
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +43,7 @@ fn no_arguments() -> Result<()> {
|
||||||
fn invalid_requirement() -> Result<()> {
|
fn invalid_requirement() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("flask==1.0.x")
|
.arg("flask==1.0.x")
|
||||||
|
|
@ -69,10 +66,7 @@ fn invalid_requirement() -> Result<()> {
|
||||||
fn missing_requirements_txt() -> Result<()> {
|
fn missing_requirements_txt() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
|
|
||||||
insta::with_settings!({
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
filters => INSTA_FILTERS.to_vec()
|
|
||||||
}, {
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
|
|
@ -85,8 +79,8 @@ fn missing_requirements_txt() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: failed to open file `requirements.txt`
|
error: failed to open file `requirements.txt`
|
||||||
Caused by: No such file or directory (os error 2)
|
Caused by: No such file or directory (os error 2)
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +92,7 @@ fn invalid_requirements_txt_requirement() -> Result<()> {
|
||||||
requirements_txt.touch()?;
|
requirements_txt.touch()?;
|
||||||
requirements_txt.write_str("flask==1.0.x")?;
|
requirements_txt.write_str("flask==1.0.x")?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
|
|
@ -122,10 +116,7 @@ fn invalid_requirements_txt_requirement() -> Result<()> {
|
||||||
fn missing_pyproject_toml() -> Result<()> {
|
fn missing_pyproject_toml() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
|
|
||||||
insta::with_settings!({
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
filters => INSTA_FILTERS.to_vec()
|
|
||||||
}, {
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
|
|
@ -138,8 +129,8 @@ fn missing_pyproject_toml() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: failed to open file `pyproject.toml`
|
error: failed to open file `pyproject.toml`
|
||||||
Caused by: No such file or directory (os error 2)
|
Caused by: No such file or directory (os error 2)
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +142,7 @@ fn invalid_pyproject_toml_syntax() -> Result<()> {
|
||||||
pyproject_toml.touch()?;
|
pyproject_toml.touch()?;
|
||||||
pyproject_toml.write_str("123 - 456")?;
|
pyproject_toml.write_str("123 - 456")?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
|
|
@ -181,7 +172,7 @@ fn invalid_pyproject_toml_schema() -> Result<()> {
|
||||||
pyproject_toml.touch()?;
|
pyproject_toml.touch()?;
|
||||||
pyproject_toml.write_str("[project]")?;
|
pyproject_toml.write_str("[project]")?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
|
|
@ -216,7 +207,7 @@ dependencies = ["flask==1.0.x"]
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("-r")
|
.arg("-r")
|
||||||
|
|
@ -243,11 +234,9 @@ dependencies = ["flask==1.0.x"]
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uninstall() -> Result<()> {
|
fn uninstall() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let context = TestContext::new("3.12");
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
|
||||||
let venv = create_venv(&temp_dir, &cache_dir, "3.12");
|
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||||
requirements_txt.touch()?;
|
requirements_txt.touch()?;
|
||||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||||
|
|
||||||
|
|
@ -256,30 +245,27 @@ fn uninstall() -> Result<()> {
|
||||||
.arg("sync")
|
.arg("sync")
|
||||||
.arg("requirements.txt")
|
.arg("requirements.txt")
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||||
.current_dir(&temp_dir)
|
.current_dir(&context.temp_dir)
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import markupsafe")
|
.arg("import markupsafe")
|
||||||
.current_dir(&temp_dir)
|
.current_dir(&context.temp_dir)
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
insta::with_settings!({
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
filters => INSTA_FILTERS.to_vec()
|
|
||||||
}, {
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("MarkupSafe")
|
.arg("MarkupSafe")
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&context.temp_dir), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -287,13 +273,13 @@ fn uninstall() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Uninstalled 1 package in [TIME]
|
Uninstalled 1 package in [TIME]
|
||||||
- markupsafe==2.1.3
|
- markupsafe==2.1.3
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import markupsafe")
|
.arg("import markupsafe")
|
||||||
.current_dir(&temp_dir)
|
.current_dir(&context.temp_dir)
|
||||||
.assert()
|
.assert()
|
||||||
.failure();
|
.failure();
|
||||||
|
|
||||||
|
|
@ -302,11 +288,9 @@ fn uninstall() -> Result<()> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn missing_record() -> Result<()> {
|
fn missing_record() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let context = TestContext::new("3.12");
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
|
||||||
let venv = create_venv(&temp_dir, &cache_dir, "3.12");
|
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = context.temp_dir.child("requirements.txt");
|
||||||
requirements_txt.touch()?;
|
requirements_txt.touch()?;
|
||||||
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
requirements_txt.write_str("MarkupSafe==2.1.3")?;
|
||||||
|
|
||||||
|
|
@ -315,27 +299,31 @@ fn missing_record() -> Result<()> {
|
||||||
.arg("sync")
|
.arg("sync")
|
||||||
.arg("requirements.txt")
|
.arg("requirements.txt")
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||||
.current_dir(&temp_dir)
|
.current_dir(&context.temp_dir)
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import markupsafe")
|
.arg("import markupsafe")
|
||||||
.current_dir(&temp_dir)
|
.current_dir(&context.temp_dir)
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
// Delete the RECORD file.
|
// Delete the RECORD file.
|
||||||
let dist_info = fs_err::canonicalize(if cfg!(unix) {
|
let dist_info = fs_err::canonicalize(if cfg!(unix) {
|
||||||
venv.join("lib")
|
context
|
||||||
|
.venv
|
||||||
|
.join("lib")
|
||||||
.join("python3.12")
|
.join("python3.12")
|
||||||
.join("site-packages")
|
.join("site-packages")
|
||||||
.join("MarkupSafe-2.1.3.dist-info")
|
.join("MarkupSafe-2.1.3.dist-info")
|
||||||
} else if cfg!(windows) {
|
} else if cfg!(windows) {
|
||||||
venv.join("Lib")
|
context
|
||||||
|
.venv
|
||||||
|
.join("Lib")
|
||||||
.join("site-packages")
|
.join("site-packages")
|
||||||
.join("MarkupSafe-2.1.3.dist-info")
|
.join("MarkupSafe-2.1.3.dist-info")
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -355,27 +343,21 @@ fn missing_record() -> Result<()> {
|
||||||
.chain(INSTA_FILTERS.to_vec())
|
.chain(INSTA_FILTERS.to_vec())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
insta::with_settings!(
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
{
|
|
||||||
filters => filters,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("MarkupSafe")
|
.arg("MarkupSafe")
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&context.temp_dir), @r###"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: Cannot uninstall package; RECORD file not found at: [DIST_INFO]/RECORD
|
error: Cannot uninstall package; RECORD file not found at: [DIST_INFO]/RECORD
|
||||||
"###);
|
"###
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -383,9 +365,7 @@ fn missing_record() -> Result<()> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uninstall_editable_by_name() -> Result<()> {
|
fn uninstall_editable_by_name() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let context = TestContext::new("3.12");
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
|
||||||
let venv = create_venv(&temp_dir, &cache_dir, "3.12");
|
|
||||||
|
|
||||||
let current_dir = std::env::current_dir()?;
|
let current_dir = std::env::current_dir()?;
|
||||||
let workspace_dir = regex::escape(
|
let workspace_dir = regex::escape(
|
||||||
|
|
@ -398,7 +378,7 @@ fn uninstall_editable_by_name() -> Result<()> {
|
||||||
.chain(INSTA_FILTERS.to_vec())
|
.chain(INSTA_FILTERS.to_vec())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = context.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")?;
|
||||||
|
|
||||||
|
|
@ -407,29 +387,25 @@ fn uninstall_editable_by_name() -> Result<()> {
|
||||||
.arg("sync")
|
.arg("sync")
|
||||||
.arg(requirements_txt.path())
|
.arg(requirements_txt.path())
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import poetry_editable")
|
.arg("import poetry_editable")
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
// Uninstall the editable by name.
|
// Uninstall the editable by name.
|
||||||
insta::with_settings!({
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
filters => filters.clone()
|
|
||||||
}, {
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("poetry-editable")
|
.arg("poetry-editable")
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str()), @r###"
|
||||||
, @r###"
|
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -437,10 +413,10 @@ fn uninstall_editable_by_name() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Uninstalled 1 package in [TIME]
|
Uninstalled 1 package in [TIME]
|
||||||
- poetry-editable==0.1.0 (from file://[WORKSPACE_DIR]/scripts/editable-installs/poetry_editable)
|
- poetry-editable==0.1.0 (from file://[WORKSPACE_DIR]/scripts/editable-installs/poetry_editable)
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import poetry_editable")
|
.arg("import poetry_editable")
|
||||||
.assert()
|
.assert()
|
||||||
|
|
@ -451,9 +427,7 @@ fn uninstall_editable_by_name() -> Result<()> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uninstall_editable_by_path() -> Result<()> {
|
fn uninstall_editable_by_path() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let context = TestContext::new("3.12");
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
|
||||||
let venv = create_venv(&temp_dir, &cache_dir, "3.12");
|
|
||||||
|
|
||||||
let current_dir = std::env::current_dir()?;
|
let current_dir = std::env::current_dir()?;
|
||||||
let workspace_dir = regex::escape(
|
let workspace_dir = regex::escape(
|
||||||
|
|
@ -466,7 +440,7 @@ fn uninstall_editable_by_path() -> Result<()> {
|
||||||
.chain(INSTA_FILTERS.to_vec())
|
.chain(INSTA_FILTERS.to_vec())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = context.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")?;
|
||||||
|
|
||||||
|
|
@ -475,29 +449,26 @@ fn uninstall_editable_by_path() -> Result<()> {
|
||||||
.arg("sync")
|
.arg("sync")
|
||||||
.arg(requirements_txt.path())
|
.arg(requirements_txt.path())
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import poetry_editable")
|
.arg("import poetry_editable")
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
// Uninstall the editable by path.
|
// Uninstall the editable by path.
|
||||||
insta::with_settings!({
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
filters => filters.clone()
|
|
||||||
}, {
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("-e")
|
.arg("-e")
|
||||||
.arg("../../scripts/editable-installs/poetry_editable")
|
.arg("../../scripts/editable-installs/poetry_editable")
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str()), @r###"
|
.env("VIRTUAL_ENV", context.venv.as_os_str()), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -505,10 +476,10 @@ fn uninstall_editable_by_path() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Uninstalled 1 package in [TIME]
|
Uninstalled 1 package in [TIME]
|
||||||
- poetry-editable==0.1.0 (from file://[WORKSPACE_DIR]/scripts/editable-installs/poetry_editable)
|
- poetry-editable==0.1.0 (from file://[WORKSPACE_DIR]/scripts/editable-installs/poetry_editable)
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import poetry_editable")
|
.arg("import poetry_editable")
|
||||||
.assert()
|
.assert()
|
||||||
|
|
@ -519,9 +490,7 @@ fn uninstall_editable_by_path() -> Result<()> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uninstall_duplicate_editable() -> Result<()> {
|
fn uninstall_duplicate_editable() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let context = TestContext::new("3.12");
|
||||||
let cache_dir = assert_fs::TempDir::new()?;
|
|
||||||
let venv = create_venv(&temp_dir, &cache_dir, "3.12");
|
|
||||||
|
|
||||||
let current_dir = std::env::current_dir()?;
|
let current_dir = std::env::current_dir()?;
|
||||||
let workspace_dir = regex::escape(
|
let workspace_dir = regex::escape(
|
||||||
|
|
@ -534,7 +503,7 @@ fn uninstall_duplicate_editable() -> Result<()> {
|
||||||
.chain(INSTA_FILTERS.to_vec())
|
.chain(INSTA_FILTERS.to_vec())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let requirements_txt = temp_dir.child("requirements.txt");
|
let requirements_txt = context.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")?;
|
||||||
|
|
||||||
|
|
@ -543,30 +512,27 @@ fn uninstall_duplicate_editable() -> Result<()> {
|
||||||
.arg("sync")
|
.arg("sync")
|
||||||
.arg(requirements_txt.path())
|
.arg(requirements_txt.path())
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str())
|
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import poetry_editable")
|
.arg("import poetry_editable")
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
// Uninstall the editable by both path and name.
|
// Uninstall the editable by both path and name.
|
||||||
insta::with_settings!({
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
filters => filters.clone()
|
|
||||||
}, {
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("pip")
|
.arg("pip")
|
||||||
.arg("uninstall")
|
.arg("uninstall")
|
||||||
.arg("poetry-editable")
|
.arg("poetry-editable")
|
||||||
.arg("-e")
|
.arg("-e")
|
||||||
.arg("../../scripts/editable-installs/poetry_editable")
|
.arg("../../scripts/editable-installs/poetry_editable")
|
||||||
.arg("--cache-dir")
|
.arg("--cache-dir")
|
||||||
.arg(cache_dir.path())
|
.arg(context.cache_dir.path())
|
||||||
.env("VIRTUAL_ENV", venv.as_os_str()), @r###"
|
.env("VIRTUAL_ENV", context.venv.as_os_str()), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -574,10 +540,10 @@ fn uninstall_duplicate_editable() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Uninstalled 1 package in [TIME]
|
Uninstalled 1 package in [TIME]
|
||||||
- poetry-editable==0.1.0 (from file://[WORKSPACE_DIR]/scripts/editable-installs/poetry_editable)
|
- poetry-editable==0.1.0 (from file://[WORKSPACE_DIR]/scripts/editable-installs/poetry_editable)
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
Command::new(venv_to_interpreter(&venv))
|
Command::new(venv_to_interpreter(&context.venv))
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("import poetry_editable")
|
.arg("import poetry_editable")
|
||||||
.assert()
|
.assert()
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,12 @@ use std::process::Command;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use assert_fs::prelude::*;
|
use assert_fs::prelude::*;
|
||||||
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};
|
use insta_cmd::get_cargo_bin;
|
||||||
|
|
||||||
use common::BIN_NAME;
|
use common::BIN_NAME;
|
||||||
|
|
||||||
|
use crate::common::puffin_snapshot;
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -13,7 +15,7 @@ fn missing_pyproject_toml() -> Result<()> {
|
||||||
let temp_dir = assert_fs::TempDir::new()?;
|
let temp_dir = assert_fs::TempDir::new()?;
|
||||||
let pyproject_toml = temp_dir.child("pyproject.toml");
|
let pyproject_toml = temp_dir.child("pyproject.toml");
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("flask")
|
.arg("flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -39,7 +41,7 @@ fn missing_project_table() -> Result<()> {
|
||||||
let pyproject_toml = temp_dir.child("pyproject.toml");
|
let pyproject_toml = temp_dir.child("pyproject.toml");
|
||||||
pyproject_toml.touch()?;
|
pyproject_toml.touch()?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("flask")
|
.arg("flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -70,7 +72,7 @@ name = "project"
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("flask")
|
.arg("flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -108,7 +110,7 @@ dependencies = [
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("requests")
|
.arg("requests")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -150,7 +152,7 @@ dependencies = [
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("flask")
|
.arg("flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -187,7 +189,7 @@ dependencies = [
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("requests")
|
.arg("requests")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -223,7 +225,7 @@ dependencies = [
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("Flask")
|
.arg("Flask")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
@ -258,7 +260,7 @@ dependencies = ["flask==1.0.0", "requests"]
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
puffin_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||||
.arg("remove")
|
.arg("remove")
|
||||||
.arg("requests")
|
.arg("requests")
|
||||||
.current_dir(&temp_dir), @r###"
|
.current_dir(&temp_dir), @r###"
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ use std::process::Command;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use assert_fs::prelude::*;
|
use assert_fs::prelude::*;
|
||||||
use insta_cmd::_macro_support::insta;
|
use insta_cmd::get_cargo_bin;
|
||||||
use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};
|
|
||||||
|
|
||||||
use puffin_fs::NormalizedDisplay;
|
|
||||||
|
|
||||||
use common::BIN_NAME;
|
use common::BIN_NAME;
|
||||||
|
use puffin_fs::NormalizedDisplay;
|
||||||
|
|
||||||
|
use crate::common::puffin_snapshot;
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
|
|
@ -20,13 +20,14 @@ fn create_venv() -> Result<()> {
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = temp_dir.child(".venv");
|
||||||
|
|
||||||
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
||||||
insta::with_settings!({
|
let filters = &[
|
||||||
filters => vec![
|
(
|
||||||
(r"Using Python 3\.\d+\.\d+ interpreter at .+", "Using Python [VERSION] interpreter at [PATH]"),
|
r"Using Python 3\.\d+\.\d+ interpreter at .+",
|
||||||
|
"Using Python [VERSION] interpreter at [PATH]",
|
||||||
|
),
|
||||||
(&filter_venv, "/home/ferris/project/.venv"),
|
(&filter_venv, "/home/ferris/project/.venv"),
|
||||||
]
|
];
|
||||||
}, {
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
.arg("venv")
|
||||||
.arg(venv.as_os_str())
|
.arg(venv.as_os_str())
|
||||||
.arg("--python")
|
.arg("--python")
|
||||||
|
|
@ -41,8 +42,8 @@ fn create_venv() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Using Python [VERSION] interpreter at [PATH]
|
Using Python [VERSION] interpreter at [PATH]
|
||||||
Creating virtualenv at: /home/ferris/project/.venv
|
Creating virtualenv at: /home/ferris/project/.venv
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
venv.assert(predicates::path::is_dir());
|
venv.assert(predicates::path::is_dir());
|
||||||
|
|
||||||
|
|
@ -56,13 +57,14 @@ fn create_venv_defaults_to_cwd() -> Result<()> {
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = temp_dir.child(".venv");
|
||||||
|
|
||||||
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
||||||
insta::with_settings!({
|
let filters = &[
|
||||||
filters => vec![
|
(
|
||||||
(r"Using Python 3\.\d+\.\d+ interpreter at .+", "Using Python [VERSION] interpreter at [PATH]"),
|
r"Using Python 3\.\d+\.\d+ interpreter at .+",
|
||||||
|
"Using Python [VERSION] interpreter at [PATH]",
|
||||||
|
),
|
||||||
(&filter_venv, "/home/ferris/project/.venv"),
|
(&filter_venv, "/home/ferris/project/.venv"),
|
||||||
]
|
];
|
||||||
}, {
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
.arg("venv")
|
||||||
.arg("--python")
|
.arg("--python")
|
||||||
.arg("3.12")
|
.arg("3.12")
|
||||||
|
|
@ -76,8 +78,8 @@ fn create_venv_defaults_to_cwd() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Using Python [VERSION] interpreter at [PATH]
|
Using Python [VERSION] interpreter at [PATH]
|
||||||
Creating virtualenv at: .venv
|
Creating virtualenv at: .venv
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
venv.assert(predicates::path::is_dir());
|
venv.assert(predicates::path::is_dir());
|
||||||
|
|
||||||
|
|
@ -91,13 +93,14 @@ fn seed() -> Result<()> {
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = temp_dir.child(".venv");
|
||||||
|
|
||||||
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
||||||
insta::with_settings!({
|
let filters = &[
|
||||||
filters => vec![
|
(
|
||||||
(r"Using Python 3\.\d+\.\d+ interpreter at .+", "Using Python [VERSION] interpreter at [PATH]"),
|
r"Using Python 3\.\d+\.\d+ interpreter at .+",
|
||||||
|
"Using Python [VERSION] interpreter at [PATH]",
|
||||||
|
),
|
||||||
(&filter_venv, "/home/ferris/project/.venv"),
|
(&filter_venv, "/home/ferris/project/.venv"),
|
||||||
]
|
];
|
||||||
}, {
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
.arg("venv")
|
||||||
.arg(venv.as_os_str())
|
.arg(venv.as_os_str())
|
||||||
.arg("--seed")
|
.arg("--seed")
|
||||||
|
|
@ -116,8 +119,8 @@ fn seed() -> Result<()> {
|
||||||
+ setuptools==69.0.3
|
+ setuptools==69.0.3
|
||||||
+ pip==23.3.2
|
+ pip==23.3.2
|
||||||
+ wheel==0.42.0
|
+ wheel==0.42.0
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
venv.assert(predicates::path::is_dir());
|
venv.assert(predicates::path::is_dir());
|
||||||
|
|
||||||
|
|
@ -131,13 +134,14 @@ fn create_venv_unknown_python_minor() -> Result<()> {
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = temp_dir.child(".venv");
|
||||||
|
|
||||||
let filter_venv = regex::escape(&venv.display().to_string());
|
let filter_venv = regex::escape(&venv.display().to_string());
|
||||||
insta::with_settings!({
|
let filters = &[
|
||||||
filters => vec![
|
(
|
||||||
(r"Using Python 3\.\d+\.\d+ interpreter at .+", "Using Python [VERSION] interpreter at [PATH]"),
|
r"Using Python 3\.\d+\.\d+ interpreter at .+",
|
||||||
|
"Using Python [VERSION] interpreter at [PATH]",
|
||||||
|
),
|
||||||
(&filter_venv, "/home/ferris/project/.venv"),
|
(&filter_venv, "/home/ferris/project/.venv"),
|
||||||
]
|
];
|
||||||
}, {
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
.arg("venv")
|
||||||
.arg(venv.as_os_str())
|
.arg(venv.as_os_str())
|
||||||
.arg("--python")
|
.arg("--python")
|
||||||
|
|
@ -151,8 +155,8 @@ fn create_venv_unknown_python_minor() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
× Couldn't find `python3.15` in PATH. Is this Python version installed?
|
× Couldn't find `python3.15` in PATH. Is this Python version installed?
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
venv.assert(predicates::path::missing());
|
venv.assert(predicates::path::missing());
|
||||||
|
|
||||||
|
|
@ -166,13 +170,14 @@ fn create_venv_unknown_python_patch() -> Result<()> {
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = temp_dir.child(".venv");
|
||||||
|
|
||||||
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
||||||
insta::with_settings!({
|
let filters = &[
|
||||||
filters => vec![
|
(
|
||||||
(r"Using Python 3\.\d+\.\d+ interpreter at .+", "Using Python [VERSION] interpreter at [PATH]"),
|
r"Using Python 3\.\d+\.\d+ interpreter at .+",
|
||||||
|
"Using Python [VERSION] interpreter at [PATH]",
|
||||||
|
),
|
||||||
(&filter_venv, "/home/ferris/project/.venv"),
|
(&filter_venv, "/home/ferris/project/.venv"),
|
||||||
]
|
];
|
||||||
}, {
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
.arg("venv")
|
||||||
.arg(venv.as_os_str())
|
.arg(venv.as_os_str())
|
||||||
.arg("--python")
|
.arg("--python")
|
||||||
|
|
@ -186,8 +191,8 @@ fn create_venv_unknown_python_patch() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
× Couldn't find `python3.8.0` in PATH. Is this Python version installed?
|
× Couldn't find `python3.8.0` in PATH. Is this Python version installed?
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
venv.assert(predicates::path::missing());
|
venv.assert(predicates::path::missing());
|
||||||
|
|
||||||
|
|
@ -201,13 +206,11 @@ fn create_venv_python_patch() -> Result<()> {
|
||||||
let venv = temp_dir.child(".venv");
|
let venv = temp_dir.child(".venv");
|
||||||
|
|
||||||
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
let filter_venv = regex::escape(&venv.normalized_display().to_string());
|
||||||
insta::with_settings!({
|
let filters = &[
|
||||||
filters => vec![
|
|
||||||
(r"interpreter at .+", "interpreter at [PATH]"),
|
(r"interpreter at .+", "interpreter at [PATH]"),
|
||||||
(&filter_venv, "/home/ferris/project/.venv"),
|
(&filter_venv, "/home/ferris/project/.venv"),
|
||||||
]
|
];
|
||||||
}, {
|
puffin_snapshot!(filters, Command::new(get_cargo_bin(BIN_NAME))
|
||||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
|
||||||
.arg("venv")
|
.arg("venv")
|
||||||
.arg(venv.as_os_str())
|
.arg(venv.as_os_str())
|
||||||
.arg("--python")
|
.arg("--python")
|
||||||
|
|
@ -222,8 +225,8 @@ fn create_venv_python_patch() -> Result<()> {
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Using Python 3.12.1 interpreter at [PATH]
|
Using Python 3.12.1 interpreter at [PATH]
|
||||||
Creating virtualenv at: /home/ferris/project/.venv
|
Creating virtualenv at: /home/ferris/project/.venv
|
||||||
"###);
|
"###
|
||||||
});
|
);
|
||||||
|
|
||||||
venv.assert(predicates::path::is_dir());
|
venv.assert(predicates::path::is_dir());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 0563417be973397d05b45cd2c5b415d7215161e3
|
||||||
Loading…
Reference in New Issue