#assets #git #binaries #test-assets-ureq

dev test-assets-ureq

Download test assets with ureq, managing them outside of git

3 releases (breaking)

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

#201 in Testing

Download history 1136/week @ 2025-01-04 423/week @ 2025-01-11 913/week @ 2025-01-18 345/week @ 2025-01-25 290/week @ 2025-02-01 457/week @ 2025-02-08 579/week @ 2025-02-15 908/week @ 2025-02-22 405/week @ 2025-03-01 449/week @ 2025-03-08 515/week @ 2025-03-15 250/week @ 2025-03-22 483/week @ 2025-03-29 316/week @ 2025-04-05 342/week @ 2025-04-12 190/week @ 2025-04-19

1,358 downloads per month
Used in 4 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.5–4.5MB
~88K SLoC