#assets #download #git #ureq #backoff #test #test-assets

test-assets-ureq

Download test assets with ureq, managing them outside of git

3 releases (breaking)

new 0.5.0 Jan 20, 2025
0.4.0 Jan 20, 2025
0.3.0 Nov 9, 2024

#288 in Cryptography

Download history 195/week @ 2024-11-03 1298/week @ 2024-11-10 336/week @ 2024-11-17 391/week @ 2024-11-24 571/week @ 2024-12-01 129/week @ 2024-12-08 156/week @ 2024-12-15 403/week @ 2024-12-22 379/week @ 2024-12-29 1046/week @ 2025-01-05 545/week @ 2025-01-12

2,398 downloads per month
Used in 3 crates

MIT/Apache

11KB
213 lines

Test Assets

Download test assets, managing them outside of git.

Changes from being a fork of test-assets:

  • Use rust library ureq and avoid compiling curl for test binaries
  • Includes backoff support

Compiler support: requires rustc 1.70.0+


lib.rs:

Download test assets, managing them outside of git

This library downloads test assets using http(s), and ensures integrity by comparing those assets to a hash. By managing the download separately, you can keep them out of VCS and don't make them bloat your repository.

Usage example:

#[test]
fn some_awesome_test() {
let asset_defs = [
TestAssetDef {
filename : format!("file_a.png"),
hash : format!("<sha256 here>"),
url : format!("https://url/to/a.png"),
},
TestAssetDef {
filename : format!("file_b.png"),
hash : format!("<sha256 here>"),
url : format!("https://url/to/a.png"),
},
];
test_assets::dl_test_files(&asset_defs,
"test-assets", true).unwrap();
// use your files here
// with path under test-assets/file_a.png and test-assets/file_b.png
}

If you have run the test once, it will re-use the files instead of re-downloading them.

Dependencies

~3–4.5MB
~81K SLoC