Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

➕ Install xvfb in Jammy image #1997

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/Dockerfiles/Ubuntu.jammy-non-free.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ RUN groupadd -r c-pac \
graphviz-dev \
locales \
rdfind \
xvfb \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
Expand Down
5 changes: 2 additions & 3 deletions CPAC/surface/tests/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""Tests for requisite surface prerequisites"""
import os
import pytest
from CPAC.utils.monitoring.custom_logging import log_subprocess
from CPAC.utils.tests.test_utils import _installation_check


@pytest.mark.parametrize("executable", ["bc", "csh"])
Expand All @@ -27,5 +27,4 @@
"have FreeSurfer.")
def test_executable(executable):
"""Make sure executable is installed"""
_, exit_code = log_subprocess([executable, "--version"])
assert exit_code == 0
_installation_check(executable, "--version")
32 changes: 32 additions & 0 deletions CPAC/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from CPAC.func_preproc import get_motion_ref
from CPAC.pipeline.nodeblock import NodeBlockFunction
from CPAC.utils.configuration import Configuration
from CPAC.utils.monitoring.custom_logging import log_subprocess
from CPAC.utils.utils import check_config_resources, check_system_deps, \
try_fetch_parameter

Expand All @@ -22,6 +23,31 @@
}


def _installation_check(command: str, flag: str) -> None:
"""Test that command is installed by running specified version or
help flag.

Parameters
----------
command : str
Command to run.

flag : str
Version or help flag to run.

Raises
------
AssertionError
If command is not installed.

Returns
-------
None
"""
_, exit_code = log_subprocess([command, flag])
assert exit_code == 0


def test_check_config_resources():
"""Test check_config_resources function."""
with mock.patch.object(multiprocessing, 'cpu_count', return_value=2), \
Expand All @@ -43,6 +69,12 @@ def test_function():
assert TR == 2.5


@pytest.mark.parametrize("executable", ["Xvfb"])
def test_executable(executable):
"""Make sure executable is installed"""
_installation_check(executable, "-help")


def test_NodeBlock_option_SSOT(): # pylint: disable=invalid-name
'''Test using NodeBlock dictionaries for SSOT for options'''
assert isinstance(get_motion_ref, NodeBlockFunction)
Expand Down