-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all test assets to single location & introduce a script to for d…
…ownloading larger test assets (#7401) ### What There's a new gcloud bucket now for test assets: https://console.cloud.google.com/storage/browser/rerun-test-assets⚠️ this is a publically readable bucket (The download script is as simple as possible though and doesn't directly depend on gcloud) Used by an upcoming PR! ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7401?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7401?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/7401) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`.
- Loading branch information
Showing
7 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
video |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
Downloads test assets used by tests. | ||
Usage: | ||
pixi run python ./tests/assets/download_assets.py | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
import os | ||
from pathlib import Path | ||
from typing import Final | ||
|
||
import requests | ||
import tqdm | ||
|
||
test_assets = ["video/Big_Buck_Bunny_1080_10s_av1.mp4"] | ||
|
||
test_asset_base_url = "https://storage.googleapis.com/rerun-test-assets/" | ||
|
||
|
||
def download_file(url: str, dst_file_path: Path) -> None: | ||
"""Download file from url to dst_fpath.""" | ||
dst_file_path.parent.mkdir(parents=True, exist_ok=True) | ||
print(f"Downloading {url} to {dst_file_path}") | ||
response = requests.get(url, stream=True) | ||
with tqdm.tqdm.wrapattr( | ||
open(dst_file_path, "wb"), | ||
"write", | ||
miniters=1, | ||
total=int(response.headers.get("content-length", 0)), | ||
desc=f"Downloading {dst_file_path.name}", | ||
) as f: | ||
for chunk in response.iter_content(chunk_size=4096): | ||
f.write(chunk) | ||
|
||
|
||
def main() -> None: | ||
"""Downloads all test assets.""" | ||
|
||
test_asset_dir: Final = Path(os.path.dirname(__file__)) | ||
|
||
for asset in test_assets: | ||
target_file = test_asset_dir / asset | ||
if not target_file.exists(): | ||
download_file(test_asset_base_url + asset, target_file) | ||
else: | ||
print(f'Skipping "{asset}" because it already exists.') | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
File renamed without changes.