From b9213e85f2adf25ea6a6b0bf1cfe994fbff365c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Zar=C4=99bski?= Date: Fri, 22 Aug 2025 08:29:32 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=B8=20=20Improve=20checks=20for=20?= =?UTF-8?q?offline=20cache=20directory=20specification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + simvue/config/parameters.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eddbea39..f778567c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Improves handling of Conda based environments in metadata collection. - Adds additional options to `Client.get_runs`. - Added ability to include environment variables within metadata for runs. +- Improves checks on `offline.cache` directory specification in config file. ## [v2.1.2](https://github.com/simvue-io/client/releases/tag/v2.1.2) - 2025-06-25 diff --git a/simvue/config/parameters.py b/simvue/config/parameters.py index 28e343ec..be54de9e 100644 --- a/simvue/config/parameters.py +++ b/simvue/config/parameters.py @@ -7,7 +7,7 @@ """ import logging -import re +import os import time import pydantic import typing @@ -53,10 +53,12 @@ class OfflineSpecifications(pydantic.BaseModel): @pydantic.field_validator("cache") @classmethod def check_valid_cache_path(cls, cache: pathlib.Path) -> pathlib.Path: - if not re.fullmatch( - r"^(\/|([a-zA-Z]:\\))?([\w\s.-]+[\\/])*[\w\s.-]*$", f"{cache}" - ): - raise AssertionError(f"Value '{cache}' is not a valid cache path.") + if not cache.parent.exists(): + raise FileNotFoundError(f"No such directory '{cache.parent}'.") + if not cache.parent.is_dir(): + raise FileNotFoundError(f"'{cache.parent}' is not a directory.") + if not os.access(cache.parent, os.W_OK): + raise AssertionError(f"'{cache.parent}' is not a writable location.") return cache From 5557c07fe4d859b5814a11f6729cd6391134d52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Zar=C4=99bski?= Date: Fri, 22 Aug 2025 08:48:24 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=92=9A=20Fix=20incorrect=20pytest=20t?= =?UTF-8?q?est=20tags=20for=20Windows=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/test_client_windows_nightlies.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_client_windows_nightlies.yml b/.github/workflows/test_client_windows_nightlies.yml index 6eb35009..7d1724fc 100644 --- a/.github/workflows/test_client_windows_nightlies.yml +++ b/.github/workflows/test_client_windows_nightlies.yml @@ -61,7 +61,7 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m object_removal -m 'not unix' -c /dev/null -p no:warnings + -m 'object_removal and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache dispatch_tests: runs-on: windows-latest @@ -85,7 +85,7 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m dispatch -m 'not unix' -c /dev/null -p no:warnings + -m 'dispatch and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache run_tests_online: runs-on: windows-latest @@ -110,7 +110,7 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m run -m online -m 'not unix' -c /dev/null -p no:warnings + -m run -m 'online and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache run_tests_offline: runs-on: windows-latest @@ -135,7 +135,7 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m run -m offline -m 'not unix' -c /dev/null -p no:warnings + -m run -m 'offline and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache config_tests: runs-on: windows-latest @@ -159,7 +159,7 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m config -m 'not unix' -c /dev/null -p no:warnings + -m 'config and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache executor_tests: runs-on: windows-latest @@ -183,7 +183,7 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m executor -n 'not unix' -c /dev/null -p no:warnings + -m 'executor and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache api_tests: runs-on: windows-latest @@ -207,7 +207,7 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m api -m 'not unix' -c /dev/null -p no:warnings + -m 'api and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache local_tests: runs-on: windows-latest @@ -231,5 +231,5 @@ jobs: SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }} run: >- python -m pytest -x - -m local -m 'not unix' -c /dev/null -p no:warnings + -m 'local and not unix' -c /dev/null -p no:warnings -n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache