Skip to content

Commit

Permalink
fix: superfluous quotes in lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Aug 2, 2023
1 parent 2b59f44 commit 2047e14
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions crates/rattler_conda_types/src/conda_lock/content_hash.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::conda_lock::Channel;
use crate::{MatchSpec, Platform};
use rattler_digest::serde::SerializableHash;
use serde::Serialize;
use serde_json_python_formatter::PythonFormatter;
use std::string::FromUtf8Error;
Expand Down Expand Up @@ -108,10 +107,9 @@ pub fn calculate_content_hash(
channels: &[Channel],
) -> Result<String, CalculateContentHashError> {
let content_data = calculate_content_data(platform, input_specs, channels)?;
let json_str = serde_json::to_string(&SerializableHash::<rattler_digest::Sha256>(
rattler_digest::compute_bytes_digest::<rattler_digest::Sha256>(&content_data),
))?;
Ok(json_str)
let content_hash =
rattler_digest::compute_bytes_digest::<rattler_digest::Sha256>(&content_data);
Ok(format!("{:x}", content_hash))
}

#[cfg(test)]
Expand All @@ -122,7 +120,7 @@ mod tests {
use crate::{MatchSpec, Platform};

#[test]
fn test_content_hash() {
fn test_content_data() {
let output = content_hash::calculate_content_data(
&Platform::Osx64,
&[MatchSpec::from_str("python =3.11.0").unwrap()],
Expand All @@ -140,4 +138,19 @@ mod tests {
// TODO: add actual hash output checking when we have a default virtual package list
//assert_eq!()
}

#[test]
fn test_content_hash() {
let output = content_hash::calculate_content_hash(
&Platform::Osx64,
&[MatchSpec::from_str("python =3.11.0").unwrap()],
&["conda-forge".into()],
)
.unwrap();

assert_eq!(
output,
"66c2193c7a9f1172bbd93eaf49119bd478d1408da018b2944974bbc8d85a6a50"
);
}
}

0 comments on commit 2047e14

Please sign in to comment.