Skip to content

Commit 0922287

Browse files
committed
fix: update test to bind mount $HOME in read-only mode
1 parent 531c29d commit 0922287

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ jobs:
226226
no_output_timeout: 2h
227227
command: |
228228
docker run -ti --rm=false \
229+
-e TEST_READONLY_FILESYSTEM=1 -v $HOME:/home/fmriprep:ro \
229230
--entrypoint="pytest" poldracklab/fmriprep:latest \
230231
/src/fmriprep/fmriprep -svx --doctest-modules
231232

fmriprep/cli/tests/test_version.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test version checks."""
2+
from os import getenv
23
from datetime import datetime
34
from pathlib import Path
45
from packaging.version import Version
@@ -165,9 +166,12 @@ def mock_get(*args, **kwargs):
165166

166167
def test_readonly(tmp_path, monkeypatch):
167168
"""Test behavior when $HOME/.cache/fmriprep/latest can't be written out."""
168-
monkeypatch.setenv('HOME', str(tmp_path))
169-
cachedir = tmp_path / '.cache'
170-
cachedir.mkdir(mode=0o555, exist_ok=True)
169+
if getenv('TEST_READONLY_FILESYSTEM'):
170+
cachedir = Path(getenv('HOME')) / '.cache'
171+
else:
172+
monkeypatch.setenv('HOME', str(tmp_path))
173+
cachedir = tmp_path / '.cache'
174+
cachedir.mkdir(mode=0o555, exist_ok=True)
171175

172176
# Make sure creating the folder will raise the exception.
173177
with pytest.raises(OSError):

0 commit comments

Comments
 (0)