@@ -0,0 +1,1830 @@
+from __future__ import absolute_import%0Aimport os%0A%0Aimport docker%0Aimport pytest%0A%0Afrom src.docker import DockerImage, DockerContainer%0Afrom src.docker.ants import ANTs%0Afrom src.docker.fsl import FSL%0Afrom src.docker.spm import SPM%0A%0Aclass TestBuildCompleteDockerImage(object):%0A    %22%22%22Build a Docker image that includes all of the supported software.%0A    %22%22%22%0A    @pytest.fixture(autouse=True)%0A    def setup(self, tmpdir):%0A        self.tmpdir = tmpdir%0A        self.client = docker.from_env()%0A%0A        base_cmd = %22FROM centos:7%22%0A        pkg_manager = %22yum%22%0A%0A        cmds = %5Bbase_cmd,%0A                ANTs('2.1.0', pkg_manager).cmd,%0A                FSL('5.0.8', pkg_manager, use_binaries=True).cmd,%0A                SPM(12, 'R2017a', pkg_manager).cmd%5D%0A        self.full_dockerfile = '%5Cn%5Cn'.join(cmds)%0A%0A        # Save Dockerfile.%0A        dockerfile_path = os.path.join(tmpdir.strpath, 'Dockerfile')%0A        with open(dockerfile_path, 'w') as fp:%0A            fp.write(self.full_dockerfile)%0A%0A    def test_build_and_run(self):%0A        %22%22%22Test building Docker image and running command within Docker%0A        container.%0A        %22%22%22%0A        tag = %22test:latest%22%0A        log_path = os.path.join(self.tmpdir.strpath, 'TEST-latest.log')%0A        img = DockerImage(path=self.tmpdir.strpath, tag=tag)%0A        image = img.build_raw(filepath=log_path)%0A%0A        container = DockerContainer(image)%0A        container.start()%0A        # %22bash -c '$SPMMCRCMD'%22 should be tested, but it blocks. How do we get%0A        # around that?%0A        cmds = %5B%22Atropos%22, %22bet2%22,%5D%0A        outputs = %5B%5D%0A        for cmd in cmds:%0A            output = container.exec_run(cmd=cmd)%0A            outputs.append(output)%0A        container.cleanup(remove=True, force=True)%0A%0A        outputs_str = ' '.join(outputs)%0A        assert %22error:%22 not in outputs_str, %22Error in command execution.%22%0A

build one large Docker image as a general test