Skip to content

Commit 7fa472c

Browse files
authored
Merge pull request #849 from simvue-io/hotfix/better-cache-checks
🚸 Improve checks for offline cache directory specification
2 parents 0778593 + 5557c07 commit 7fa472c

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

.github/workflows/test_client_windows_nightlies.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
6262
run: >-
6363
python -m pytest -x
64-
-m object_removal -m 'not unix' -c /dev/null -p no:warnings
64+
-m 'object_removal and not unix' -c /dev/null -p no:warnings
6565
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache
6666
dispatch_tests:
6767
runs-on: windows-latest
@@ -85,7 +85,7 @@ jobs:
8585
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
8686
run: >-
8787
python -m pytest -x
88-
-m dispatch -m 'not unix' -c /dev/null -p no:warnings
88+
-m 'dispatch and not unix' -c /dev/null -p no:warnings
8989
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache
9090
run_tests_online:
9191
runs-on: windows-latest
@@ -110,7 +110,7 @@ jobs:
110110
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
111111
run: >-
112112
python -m pytest -x
113-
-m run -m online -m 'not unix' -c /dev/null -p no:warnings
113+
-m run -m 'online and not unix' -c /dev/null -p no:warnings
114114
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache
115115
run_tests_offline:
116116
runs-on: windows-latest
@@ -135,7 +135,7 @@ jobs:
135135
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
136136
run: >-
137137
python -m pytest -x
138-
-m run -m offline -m 'not unix' -c /dev/null -p no:warnings
138+
-m run -m 'offline and not unix' -c /dev/null -p no:warnings
139139
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache
140140
config_tests:
141141
runs-on: windows-latest
@@ -159,7 +159,7 @@ jobs:
159159
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
160160
run: >-
161161
python -m pytest -x
162-
-m config -m 'not unix' -c /dev/null -p no:warnings
162+
-m 'config and not unix' -c /dev/null -p no:warnings
163163
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache
164164
executor_tests:
165165
runs-on: windows-latest
@@ -183,7 +183,7 @@ jobs:
183183
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
184184
run: >-
185185
python -m pytest -x
186-
-m executor -n 'not unix' -c /dev/null -p no:warnings
186+
-m 'executor and not unix' -c /dev/null -p no:warnings
187187
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache
188188
api_tests:
189189
runs-on: windows-latest
@@ -207,7 +207,7 @@ jobs:
207207
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
208208
run: >-
209209
python -m pytest -x
210-
-m api -m 'not unix' -c /dev/null -p no:warnings
210+
-m 'api and not unix' -c /dev/null -p no:warnings
211211
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache
212212
local_tests:
213213
runs-on: windows-latest
@@ -231,5 +231,5 @@ jobs:
231231
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
232232
run: >-
233233
python -m pytest -x
234-
-m local -m 'not unix' -c /dev/null -p no:warnings
234+
-m 'local and not unix' -c /dev/null -p no:warnings
235235
-n 0 -v -o cache_dir=${GITHUB_WORKSPACE}/.pytest-cache

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Improves handling of Conda based environments in metadata collection.
66
- Adds additional options to `Client.get_runs`.
77
- Added ability to include environment variables within metadata for runs.
8+
- Improves checks on `offline.cache` directory specification in config file.
89

910
## [v2.1.2](https://github.com/simvue-io/client/releases/tag/v2.1.2) - 2025-06-25
1011

simvue/config/parameters.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99
import logging
10-
import re
10+
import os
1111
import time
1212
import pydantic
1313
import typing
@@ -53,10 +53,12 @@ class OfflineSpecifications(pydantic.BaseModel):
5353
@pydantic.field_validator("cache")
5454
@classmethod
5555
def check_valid_cache_path(cls, cache: pathlib.Path) -> pathlib.Path:
56-
if not re.fullmatch(
57-
r"^(\/|([a-zA-Z]:\\))?([\w\s.-]+[\\/])*[\w\s.-]*$", f"{cache}"
58-
):
59-
raise AssertionError(f"Value '{cache}' is not a valid cache path.")
56+
if not cache.parent.exists():
57+
raise FileNotFoundError(f"No such directory '{cache.parent}'.")
58+
if not cache.parent.is_dir():
59+
raise FileNotFoundError(f"'{cache.parent}' is not a directory.")
60+
if not os.access(cache.parent, os.W_OK):
61+
raise AssertionError(f"'{cache.parent}' is not a writable location.")
6062
return cache
6163

6264

0 commit comments

Comments
 (0)