forked from astral-sh/rye
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip
uv compile
step for URL-based dependencies in add
command
- Loading branch information
Showing
4 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ use std::fs; | |
|
||
use toml_edit::{value, ArrayOfTables, Table}; | ||
|
||
use crate::common::{rye_cmd_snapshot, Space}; | ||
use crate::common::{get_fixtures_dir, rye_cmd_snapshot, Space}; | ||
|
||
mod common; | ||
|
||
|
@@ -163,3 +163,75 @@ fn test_add_flask_wrong_venv_exported() { | |
"###); | ||
fs::remove_dir_all(&fake_venv).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn test_add_from_file_path() { | ||
let space = Space::new(); | ||
space.init("my-project"); | ||
let fake_venv = space.project_path().join("fake-venv"); | ||
fs::create_dir_all(&fake_venv).unwrap(); | ||
|
||
let wheel_path = get_fixtures_dir() | ||
.join("wheels") | ||
.join("twine-1.5.0-py2.py3-none-any.whl"); | ||
rye_cmd_snapshot!(space.rye_cmd().arg("add").arg("twine").arg("--path").arg(wheel_path).env("VIRTUAL_ENV", fake_venv.as_os_str()), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
Initializing new virtualenv in [TEMP_PATH]/project/.venv | ||
Python version: [email protected] | ||
Added twine @ file:[FIXTURES]/wheels/twine-1.5.0-py2.py3-none-any.whl as regular dependency | ||
Reusing already existing virtualenv | ||
Generating production lockfile: [TEMP_PATH]/project/requirements.lock | ||
Generating dev lockfile: [TEMP_PATH]/project/requirements-dev.lock | ||
Installing dependencies | ||
Done! | ||
----- stderr ----- | ||
Built 1 editable in [EXECUTION_TIME] | ||
Resolved 7 packages in [EXECUTION_TIME] | ||
Downloaded 7 packages in [EXECUTION_TIME] | ||
Installed 8 packages in [EXECUTION_TIME] | ||
+ certifi==2023.11.17 | ||
+ charset-normalizer==3.3.2 | ||
+ idna==3.4 | ||
+ my-project==0.1.0 (from file:[TEMP_PATH]/project) | ||
+ pkginfo==1.9.6 | ||
+ requests==2.31.0 | ||
+ twine==1.5.0 (from file:[FIXTURES]/wheels/twine-1.5.0-py2.py3-none-any.whl) | ||
+ urllib3==2.1.0 | ||
"###); | ||
fs::remove_dir_all(&fake_venv).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn test_add_from_remote_url() { | ||
let space = Space::new(); | ||
space.init("my-project"); | ||
let fake_venv = space.project_path().join("fake-venv"); | ||
fs::create_dir_all(&fake_venv).unwrap(); | ||
|
||
let url = "https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686"; | ||
rye_cmd_snapshot!(space.rye_cmd().arg("add").arg("pip").arg("--url").arg(url).env("VIRTUAL_ENV", fake_venv.as_os_str()), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
Initializing new virtualenv in [TEMP_PATH]/project/.venv | ||
Python version: [email protected] | ||
Added pip @ https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686 as regular dependency | ||
Reusing already existing virtualenv | ||
Generating production lockfile: [TEMP_PATH]/project/requirements.lock | ||
Generating dev lockfile: [TEMP_PATH]/project/requirements-dev.lock | ||
Installing dependencies | ||
Done! | ||
----- stderr ----- | ||
Built 1 editable in [EXECUTION_TIME] | ||
Resolved 1 package in [EXECUTION_TIME] | ||
Downloaded 1 package in [EXECUTION_TIME] | ||
Installed 2 packages in [EXECUTION_TIME] | ||
+ my-project==0.1.0 (from file:[TEMP_PATH]/project) | ||
+ pip==1.3.1 (from https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686) | ||
"###); | ||
fs::remove_dir_all(&fake_venv).unwrap(); | ||
} |