Skip to content

Commit

Permalink
Merge branch 'main' into cp-publish-twine
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko authored Feb 25, 2024
2 parents 8bc3d41 + 18d2bfa commit 8389cb4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ _Unreleased_

- `publish` now includes `--skip-save-credentials`. #759

- rye no longer fails if an incorrect `VIRTUAL_ENV` environment
variable is exported. #766

<!-- released start -->

## 0.26.0
Expand Down
1 change: 1 addition & 0 deletions rye/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ fn generate_lockfile(
cmd.arg("pip")
.arg("compile")
.arg("--no-header")
.env_remove("VIRTUAL_ENV")
.arg(format!(
"--python-version={}.{}.{}",
py_ver.major, py_ver.minor, py_ver.patch
Expand Down
2 changes: 1 addition & 1 deletion rye/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl Space {
#[allow(unused)]
pub fn read_toml<P: AsRef<Path>>(&self, path: P) -> toml_edit::Document {
let p = self.project_path().join(path.as_ref());
std::fs::read_to_string(&p).unwrap().parse().unwrap()
std::fs::read_to_string(p).unwrap().parse().unwrap()
}

#[allow(unused)]
Expand Down
45 changes: 45 additions & 0 deletions rye/tests/test_add.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fs;

use toml_edit::{value, ArrayOfTables, Table};

use crate::common::{rye_cmd_snapshot, Space};
Expand Down Expand Up @@ -86,3 +88,46 @@ fn test_add_from_find_links() {
+ tqdm==4.66.1
"###);
}

#[test]
fn test_add_flask_wrong_venv_exported() {
let space = Space::new();
space.init("my-project");
let fake_venv = space.project_path().join("fake-venv");
fs::create_dir_all(&fake_venv).unwrap();
// add colorama to ensure we have this as a dependency on all platforms
rye_cmd_snapshot!(space.rye_cmd().arg("add").arg("flask==3.0.0").arg("colorama").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 colorama>=0.4.6 as regular dependency
Added flask>=3.0.0 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 9 packages in [EXECUTION_TIME]
Built 1 editable in [EXECUTION_TIME]
Resolved 9 packages in [EXECUTION_TIME]
Built 1 editable in [EXECUTION_TIME]
Resolved 8 packages in [EXECUTION_TIME]
Downloaded 8 packages in [EXECUTION_TIME]
Installed 9 packages in [EXECUTION_TIME]
+ blinker==1.7.0
+ click==8.1.7
+ colorama==0.4.6
+ flask==3.0.0
+ itsdangerous==2.1.2
+ jinja2==3.1.2
+ markupsafe==2.1.3
+ my-project==0.1.0 (from file:[TEMP_PATH]/project)
+ werkzeug==3.0.1
"###);
fs::remove_dir_all(&fake_venv).unwrap();
}

0 comments on commit 8389cb4

Please sign in to comment.