Fix pep508_rs doc test (#963)

Since nextest does not run doctests, this did not show up on CI.
This commit is contained in:
konsti 2024-01-18 15:24:30 +01:00 committed by GitHub
parent 5ec5a3243c
commit 7acde5a9a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View file

@ -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(

View file

@ -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(())
/// # }
/// ```