diff --git a/.circleci/config.yml b/.circleci/config.yml index 33e7527233a..c5c41112030 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -214,6 +214,8 @@ jobs: docker run -u $( id -u ) -it --rm=false -w /src/niworkflows \ -e COVERAGE_FILE=/tmp/summaries/.pytest.coverage \ -e TEST_DATA_HOME=/data -v /tmp/data:/data \ + -e FS_LICENSE=/etc/fslicense.txt \ + -v /tmp/fslicense/license.txt:/etc/fslicense.txt:ro \ -v ${PWD}:/tmp niworkflows:latest \ pytest --junit-xml=/tmp/summaries/pytest.xml \ --cov niworkflows --cov-report xml:/tmp/summaries/unittests.xml \ diff --git a/niworkflows/utils/tests/test_misc.py b/niworkflows/utils/tests/test_misc.py index 7464d7bfcce..736e9cd86e5 100644 --- a/niworkflows/utils/tests/test_misc.py +++ b/niworkflows/utils/tests/test_misc.py @@ -1,4 +1,6 @@ """Test misc module.""" +import os +import shutil from unittest import mock import pytest @@ -30,3 +32,17 @@ def test_fs_license_check(stdout, rc, valid): mocked_run.return_value.stdout = stdout mocked_run.return_value.returncode = rc assert check_valid_fs_license() is valid + + +@pytest.mark.skipif(not os.getenv("FS_LICENSE"), reason="No FS license found") +def test_fs_license_check2(monkeypatch): + """Execute the canary itself.""" + assert check_valid_fs_license() is True + + +@pytest.mark.skipif(shutil.which('mri_convert') is None, reason="FreeSurfer not installed") +def test_fs_license_check3(monkeypatch): + with monkeypatch.context() as m: + m.delenv("FS_LICENSE", raising=False) + m.delenv("FREESURFER_HOME", raising=False) + assert check_valid_fs_license() is False diff --git a/setup.cfg b/setup.cfg index 03e166f751a..a03991be25d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -56,7 +56,7 @@ console_scripts = niworkflows = data/*.txt data/*.json - niworkflows/data/sentinel.nii.gz + data/sentinel.nii.gz reports/default.yml reports/report.tpl