From 7acde5a9a09b4f199daf3fa3197ec03d6bbf16bd Mon Sep 17 00:00:00 2001 From: konsti Date: Thu, 18 Jan 2024 15:24:30 +0100 Subject: [PATCH] Fix `pep508_rs` doc test (#963) Since nextest does not run doctests, this did not show up on CI. --- crates/install-wheel-rs/src/wheel.rs | 2 +- crates/pep508-rs/src/marker.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/install-wheel-rs/src/wheel.rs b/crates/install-wheel-rs/src/wheel.rs index 651c90138186..be19345d786c 100644 --- a/crates/install-wheel-rs/src/wheel.rs +++ b/crates/install-wheel-rs/src/wheel.rs @@ -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( diff --git a/crates/pep508-rs/src/marker.rs b/crates/pep508-rs/src/marker.rs index 8727dd6f8f4c..fc5786cc58d5 100644 --- a/crates/pep508-rs/src/marker.rs +++ b/crates/pep508-rs/src/marker.rs @@ -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 = (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(()) /// # } /// ```