715f28fd39
As per https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html Before that, there were 91 separate integration tests binary. (As discussed on Discord — I've done the `uv` crate, there's still a few more commits coming before this is mergeable, and I want to see how it performs in CI and locally).
34 lines
1.2 KiB
Rust
34 lines
1.2 KiB
Rust
use std::str::FromStr;
|
|
|
|
use anyhow::Result;
|
|
use url::Url;
|
|
|
|
use uv_cache::Cache;
|
|
use uv_client::RegistryClientBuilder;
|
|
use uv_distribution_filename::WheelFilename;
|
|
use uv_distribution_types::{BuiltDist, DirectUrlBuiltDist, IndexCapabilities};
|
|
use uv_pep508::VerbatimUrl;
|
|
|
|
#[tokio::test]
|
|
async fn remote_metadata_with_and_without_cache() -> Result<()> {
|
|
let cache = Cache::temp()?.init()?;
|
|
let client = RegistryClientBuilder::new(cache).build();
|
|
|
|
// The first run is without cache (the tempdir is empty), the second has the cache from the
|
|
// first run.
|
|
for _ in 0..2 {
|
|
let url = "https://files.pythonhosted.org/packages/00/e5/f12a80907d0884e6dff9c16d0c0114d81b8cd07dc3ae54c5e962cc83037e/tqdm-4.66.1-py3-none-any.whl";
|
|
let filename = WheelFilename::from_str(url.rsplit_once('/').unwrap().1)?;
|
|
let dist = BuiltDist::DirectUrl(DirectUrlBuiltDist {
|
|
filename,
|
|
location: Url::parse(url).unwrap(),
|
|
url: VerbatimUrl::from_str(url).unwrap(),
|
|
});
|
|
let capabilities = IndexCapabilities::default();
|
|
let metadata = client.wheel_metadata(&dist, &capabilities).await.unwrap();
|
|
assert_eq!(metadata.version.to_string(), "4.66.1");
|
|
}
|
|
|
|
Ok(())
|
|
}
|