From c68b87559bca99d7c3600eee1bb7cac5652490bd Mon Sep 17 00:00:00 2001 From: Martin Craig <martin.craig@eng.ox.ac.uk> Date: Tue, 25 Feb 2020 14:26:45 +0000 Subject: [PATCH] Add a couple of simple tests for WSL run functionality --- tests/test_platform.py | 10 ++++++++++ tests/test_run.py | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/tests/test_platform.py b/tests/test_platform.py index 05321fb43..9fbb004cb 100644 --- a/tests/test_platform.py +++ b/tests/test_platform.py @@ -212,3 +212,13 @@ def test_detect_ssh(): p = fslplatform.Platform() assert not p.inSSHSession assert not p.inVNCSession + +def test_fslwsl(): + + with mock.patch.dict('os.environ', **{ 'FSLWSL' : '1'}): + p = fslplatform.Platform() + assert p.fslwsl + + with mock.patch.dict('os.environ', **{ 'FSLWSL' : '0'}): + p = fslplatform.Platform() + assert not p.fslwsl diff --git a/tests/test_run.py b/tests/test_run.py index 363d4489e..39df3603c 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -410,3 +410,7 @@ def test_run_logcmd(): assert stdout == expstdout assert open('my_stdout', 'rt').read() == expcmd + expstdout + +def test_wslpath(): + assert run.wslpath('c:\\Users\\Fishcake\\image.nii.gz') == '/mnt/c/Users/Fishcake/image.nii.gz' + assert run.wslpath('--input=x:\\transfers\\scratch\\image_2.nii') == '--input=/mnt/x/transfers/scratch/image_2.nii' -- GitLab