Skip to content

Commit 2fa6b8a

Browse files
Extend optional dependency tests
1 parent 1f6e30d commit 2fa6b8a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

crates/pixi/tests/integration_rust/pypi_tests.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ async fn pyproject_optional_dependencies_resolve_recursively() {
2121

2222
let simple = PyPIDatabase::new()
2323
.with(PyPIPackage::new("numpy", "1.0.0"))
24+
.with(PyPIPackage::new("sphinx", "1.0.0"))
25+
.with(PyPIPackage::new("pytest", "1.0.0"))
2426
.into_simple_index()
2527
.unwrap();
2628

@@ -50,6 +52,10 @@ name = "recursive-optional-groups"
5052
np = ["numpy"]
5153
all = ["recursive-optional-groups[np]"]
5254
55+
[dependency-groups]
56+
docs = ["sphinx"]
57+
test = ["recursive-optional-groups[np]", "pytest", {{include-group = "docs"}}]
58+
5359
[tool.pixi.project]
5460
channels = ["{channel_url}"]
5561
platforms = ["{platform}"]
@@ -63,6 +69,7 @@ index-url = "{index_url}"
6369
[tool.pixi.environments]
6470
np = {{features = ["np"]}}
6571
all = {{features = ["all"]}}
72+
test = {{features = ["test"]}}
6673
"#,
6774
platform = platform_str,
6875
channel_url = channel_url,
@@ -74,14 +81,23 @@ all = {{features = ["all"]}}
7481
let lock = pixi.update_lock_file().await.unwrap();
7582

7683
let numpy_req = Requirement::from_str("numpy").unwrap();
84+
let sphinx_req = Requirement::from_str("sphinx").unwrap();
7785
assert!(
7886
lock.contains_pep508_requirement("np", platform, numpy_req.clone()),
7987
"np environment should include numpy from optional dependencies"
8088
);
8189
assert!(
82-
lock.contains_pep508_requirement("all", platform, numpy_req),
90+
lock.contains_pep508_requirement("all", platform, numpy_req.clone()),
8391
"all environment should include numpy inherited from recursive optional dependency"
8492
);
93+
assert!(
94+
lock.contains_pep508_requirement("test", platform, numpy_req),
95+
"test environment should include numpy inherited from recursive optional dependency"
96+
);
97+
assert!(
98+
lock.contains_pep508_requirement("test", platform, sphinx_req),
99+
"test environment should include sphinx inherited from recursive dependency group"
100+
);
85101
}
86102

87103
#[tokio::test]

0 commit comments

Comments
 (0)