mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Default to puffin venv
path to .venv
(#261)
Closes https://github.com/astral-sh/puffin/issues/236
This commit is contained in:
parent
e00d208318
commit
0dc7e6335e
3 changed files with 37 additions and 0 deletions
|
@ -147,6 +147,7 @@ struct VenvArgs {
|
|||
python: Option<PathBuf>,
|
||||
|
||||
/// The path to the virtual environment to create.
|
||||
#[clap(default_value = ".venv")]
|
||||
name: PathBuf,
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
source: crates/puffin-cli/tests/venv.rs
|
||||
info:
|
||||
program: puffin
|
||||
args:
|
||||
- venv
|
||||
---
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Using Python interpreter: /usr/bin/python3
|
||||
Creating virtual environment at: .venv
|
||||
|
|
@ -30,3 +30,24 @@ fn create_venv() -> Result<()> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_venv_defaults_to_cwd() -> Result<()> {
|
||||
let tempdir = assert_fs::TempDir::new()?;
|
||||
let venv = tempdir.child(".venv");
|
||||
|
||||
insta::with_settings!({
|
||||
filters => vec![
|
||||
(r"Using Python interpreter: .+", "Using Python interpreter: /usr/bin/python3"),
|
||||
(tempdir.to_str().unwrap(), "/home/ferris/project"),
|
||||
]
|
||||
}, {
|
||||
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
|
||||
.arg("venv")
|
||||
.current_dir(&tempdir));
|
||||
});
|
||||
|
||||
venv.assert(predicates::path::is_dir());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue