Skip to content

Commit

Permalink
Use a dedicated all-tests features instead of all-features
Browse files Browse the repository at this point in the history
Features can change behaviour, e.g. the pyo3 feature setting linker options and #941 setting the stack size. Instead of running tests with all features, we list the features required for tests.

The old command
```
cargo nextest run --all --all-features --status-level skip --failure-output immediate-final --no-fail-fast -j 12
```
and the new command
```
cargo nextest run --all --features all-tests --status-level skip --failure-output immediate-final --no-fail-fast -j 12
```
run the same tests.

This includes a fix for the pep508_rs `evaluate_extras_and_python_version` doc test, which is only run by `cargo test` but not by `cargo nextest`.

This is required for #941.
  • Loading branch information
konstin committed Jan 18, 2024
1 parent fb22680 commit d9efe22
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ jobs:
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Tests"
run: cargo nextest run --all --all-features --status-level skip --failure-output immediate-final --no-fail-fast -j 12
run: cargo nextest run --all --features all-tests --status-level skip --failure-output immediate-final --no-fail-fast -j 12
2 changes: 1 addition & 1 deletion crates/install-wheel-rs/src/wheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ pub(crate) fn write_script_entrypoints(
record,
)?;
// We need to make the launcher executable
#[cfg(target_family = "unix")]
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
fs::set_permissions(
Expand Down
11 changes: 6 additions & 5 deletions crates/pep508-rs/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,15 +733,16 @@ impl MarkerExpression {
/// # use pep440_rs::Version;
///
/// # fn main() -> Result<(), Pep508Error> {
/// use puffin_normalize::ExtraName;
/// let marker_tree = MarkerTree::from_str(r#"("linux" in sys_platform) and extra == 'day'"#)?;
/// let versions: Vec<Version> = (8..12).map(|minor| Version::new([3, minor])).collect();
/// assert!(marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &versions));
/// assert!(!marker_tree.evaluate_extras_and_python_version(&["night".to_string()].into(), &versions));
/// assert!(marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &versions));
/// assert!(!marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("night").unwrap()].into(), &versions));
///
/// let marker_tree = MarkerTree::from_str(r#"extra == 'day' and python_version < '3.11' and '3.10' <= python_version"#)?;
/// assert!(!marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &vec![Version::new([3, 9])]));
/// assert!(marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &vec![Version::new([3, 10])]));
/// assert!(!marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &vec![Version::new([3, 11])]));
/// assert!(!marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &vec![Version::new([3, 9])]));
/// assert!(marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &vec![Version::new([3, 10])]));
/// assert!(!marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &vec![Version::new([3, 11])]));
/// # Ok(())
/// # }
/// ```
Expand Down
3 changes: 3 additions & 0 deletions crates/puffin-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ pypi = []
git = []
# Introduces a dependency on Maturin.
maturin = []

# Activate all feature gated tests
all-tests = ["python", "pypi", "git", "maturin"]
3 changes: 3 additions & 0 deletions crates/puffin-resolver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ insta = { version = "1.34.0" }
[features]
# Introduces a dependency on PyPI.
pypi = []

# Activate all feature gated tests
all-tests = ["pypi"]

0 comments on commit d9efe22

Please sign in to comment.