[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 5/8] tests_pytest: Implement fetch_asset() method for dow
From: |
Alex Bennée |
Subject: |
Re: [RFC PATCH 5/8] tests_pytest: Implement fetch_asset() method for downloading assets |
Date: |
Thu, 11 Jul 2024 20:23:03 +0100 |
Richard Henderson <richard.henderson@linaro.org> writes:
> On 7/11/24 09:45, Richard Henderson wrote:
>> On 7/11/24 04:55, Thomas Huth wrote:
>>> + def fetch_asset(self, url, asset_hash):
>>> + cache_dir = os.path.expanduser("~/.cache/qemu/download")
>>> + if not os.path.exists(cache_dir):
>>> + os.makedirs(cache_dir)
>>> + fname = os.path.join(cache_dir,
>>> + hashlib.sha1(url.encode("utf-8")).hexdigest())
>>> + if os.path.exists(fname) and self.check_hash(fname, asset_hash):
>>> + return fname
>>> + logging.debug("Downloading %s to %s...", url, fname)
>>> + subprocess.check_call(["wget", "-c", url, "-O", fname +
>>> ".download"])
>>> + os.rename(fname + ".download", fname)
>>> + return fname
>> Download failure via exception?
>> Check hash on downloaded asset?
>
> I would prefer to see assets, particularly downloading, handled in a
> separate pass from tests.
And I assume cachable?
>
> (1) Asset download should not count against test timeout.
> (2) Running tests while disconnected should skip unavailable assets.
>
> Avocado kinda does this, but still generates errors instead of skips.
>
>
> r~
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
- [RFC PATCH 4/8] tests/pytest: add pytest to the meson build system, (continued)
[RFC PATCH 5/8] tests_pytest: Implement fetch_asset() method for downloading assets, Thomas Huth, 2024/07/11
Re: [RFC PATCH 5/8] tests_pytest: Implement fetch_asset() method for downloading assets, Thomas Huth, 2024/07/12
Re: [RFC PATCH 5/8] tests_pytest: Implement fetch_asset() method for downloading assets, Thomas Huth, 2024/07/12
Re: [RFC PATCH 5/8] tests_pytest: Implement fetch_asset() method for downloading assets, Daniel P . Berrangé, 2024/07/12
[RFC PATCH 8/8] tests/pytest: Convert avocado test that needed avocado.utils.archive, Thomas Huth, 2024/07/11
[RFC PATCH 7/8] tests/pytest: Add a function for extracting files from an archive, Thomas Huth, 2024/07/11