<commit_before>"""Tests for neurodocker.interfaces.SPM"""
# Author: <NAME> <<EMAIL>>
from __future__ import absolute_import, division, print_function

from neurodocker.interfaces import SPM
from neurodocker.interfaces.tests import utils

class TestSPM(object):
    """Tests for SPM class."""

    def test_build_image_spm_12_standalone_centos7(self):
        """Install standalone SPM12 and MATLAB MCR R2017a."""
        specs = {'pkg_manager': 'yum',
                 'check_urls': True,
                 'instructions': [
                    ('base', 'centos:7'),
                    ('spm', {'version': '12', 'matlab_version': 'R2017a'}),
                    ('user', 'neuro'),
                 ]}
        container = utils.get_container_from_specs(specs)

        cmd = ["/bin/bash", "-c", """echo 'fprintf("desired output")' > /tmp/test.m """]
        container.exec_run(cmd)
        # QUESTION: how can we run the entrypoint on a container in the
        # background? The cmd below is a workaround because the entrypoint is
        # not being run, so SPMMCRCMD is not set.
        cmd = ["/bin/bash", "-c",
               'source /neurodocker/startup.sh true && $SPMMCRCMD /tmp/test.m']
        output = container.exec_run(cmd)
        assert "error" not in output.lower(), "error running SPM command"
        assert "desired output" in output, "expected output not found"
        utils.test_cleanup(container)<commit_msg>user debian stretch because centos epel is giving temporary issues<commit_after>"""Tests for neurodocker.interfaces.SPM"""
# Author: <NAME> <<EMAIL>>
from __future__ import absolute_import, division, print_function

from neurodocker.interfaces import SPM
from neurodocker.interfaces.tests import utils

class TestSPM(object):
    """Tests for SPM class."""

    def test_build_image_spm_12_standalone_stretch(self):
        """Install standalone SPM12 and MATLAB MCR R2017a."""
        specs = {'pkg_manager': 'apt',
                 'check_urls': True,
                 'instructions': [
                    ('base', 'debian:stretch'),
                    ('spm', {'version': '12', 'matlab_version': 'R2017a'}),
                    ('user', 'neuro'),
                 ]}
        container = utils.get_container_from_specs(specs)

        cmd = ["/bin/bash", "-c", """echo 'fprintf("desired output")' > /tmp/test.m """]
        container.exec_run(cmd)
        # QUESTION: how can we run the entrypoint on a container in the
        # background? The cmd below is a workaround because the entrypoint is
        # not being run, so SPMMCRCMD is not set.
        cmd = ["/bin/bash", "-c",
               'source /neurodocker/startup.sh true && $SPMMCRCMD /tmp/test.m']
        output = container.exec_run(cmd)
        assert "error" not in output.lower(), "error running SPM command"
        assert "desired output" in output, "expected output not found"
        utils.test_cleanup(container)
{'fraction_non_alphanumeric': 0.12538540596094552, 'fraction_numerical': 0.010277492291880781, 'mean_word_length': 2.5784313725490198, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3211788', 'n_tokens_mistral': 884, 'n_tokens_neox': 840, 'n_words': 248}