mirror of https://github.com/astral-sh/uv
Only run debug assertion tests when debug assertions are active (#16479)
These tests currently fail when running tests in release mode.
This commit is contained in:
parent
fce1db39f2
commit
c279b4ab54
|
|
@ -404,12 +404,13 @@ mod tests {
|
||||||
let url = Url::parse("file:/etc/bin/").unwrap();
|
let url = Url::parse("file:/etc/bin/").unwrap();
|
||||||
let keyring = KeyringProvider::empty();
|
let keyring = KeyringProvider::empty();
|
||||||
// Panics due to debug assertion; returns `None` in production
|
// Panics due to debug assertion; returns `None` in production
|
||||||
let result = std::panic::AssertUnwindSafe(
|
let fetch = keyring.fetch(DisplaySafeUrl::ref_cast(&url), Some("user"));
|
||||||
keyring.fetch(DisplaySafeUrl::ref_cast(&url), Some("user")),
|
if cfg!(debug_assertions) {
|
||||||
)
|
let result = std::panic::AssertUnwindSafe(fetch).catch_unwind().await;
|
||||||
.catch_unwind()
|
|
||||||
.await;
|
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
|
} else {
|
||||||
|
assert_eq!(fetch.await, None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
@ -417,12 +418,13 @@ mod tests {
|
||||||
let url = Url::parse("https://user:password@example.com").unwrap();
|
let url = Url::parse("https://user:password@example.com").unwrap();
|
||||||
let keyring = KeyringProvider::empty();
|
let keyring = KeyringProvider::empty();
|
||||||
// Panics due to debug assertion; returns `None` in production
|
// Panics due to debug assertion; returns `None` in production
|
||||||
let result = std::panic::AssertUnwindSafe(
|
let fetch = keyring.fetch(DisplaySafeUrl::ref_cast(&url), Some(url.username()));
|
||||||
keyring.fetch(DisplaySafeUrl::ref_cast(&url), Some(url.username())),
|
if cfg!(debug_assertions) {
|
||||||
)
|
let result = std::panic::AssertUnwindSafe(fetch).catch_unwind().await;
|
||||||
.catch_unwind()
|
|
||||||
.await;
|
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
|
} else {
|
||||||
|
assert_eq!(fetch.await, None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
@ -430,12 +432,13 @@ mod tests {
|
||||||
let url = Url::parse("https://example.com").unwrap();
|
let url = Url::parse("https://example.com").unwrap();
|
||||||
let keyring = KeyringProvider::empty();
|
let keyring = KeyringProvider::empty();
|
||||||
// Panics due to debug assertion; returns `None` in production
|
// Panics due to debug assertion; returns `None` in production
|
||||||
let result = std::panic::AssertUnwindSafe(
|
let fetch = keyring.fetch(DisplaySafeUrl::ref_cast(&url), Some(url.username()));
|
||||||
keyring.fetch(DisplaySafeUrl::ref_cast(&url), Some(url.username())),
|
if cfg!(debug_assertions) {
|
||||||
)
|
let result = std::panic::AssertUnwindSafe(fetch).catch_unwind().await;
|
||||||
.catch_unwind()
|
|
||||||
.await;
|
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
|
} else {
|
||||||
|
assert_eq!(fetch.await, None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue