Skip to content

Commit

Permalink
test: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jan 16, 2025
1 parent 8cef5c0 commit dd6d6ba
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/polars-io/src/cloud/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use regex::Regex;
#[cfg(feature = "http")]
use reqwest::header::HeaderMap;
#[cfg(feature = "serde")]
use serde::Deserializer;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "cloud")]
use url::Url;
Expand Down Expand Up @@ -78,10 +80,18 @@ pub struct CloudOptions {
pub file_cache_ttl: u64,
pub(crate) config: Option<CloudConfig>,
#[cfg(feature = "cloud")]
#[cfg_attr(feature = "serde", serde(skip))] // skipped for polars-cloud
#[cfg_attr(feature = "serde", serde(deserialize_with = "deserialize_or_default"))]
pub(crate) credential_provider: Option<PlCredentialProvider>,
}

fn deserialize_or_default<'de, D>(deserializer: D) -> Result<Option<PlCredentialProvider>, D::Error>
where
D: Deserializer<'de>,
{
type T = Option<PlCredentialProvider>;
T::deserialize(deserializer).or_else(|_| Ok(Default::default()))
}

impl Default for CloudOptions {
fn default() -> Self {
Self::default_static_ref().clone()
Expand Down

0 comments on commit dd6d6ba

Please sign in to comment.