Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_distro_centos(self):
"""Base image Linux distribution specification"""
b = baseimage(image='foo', _distro='centos')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.CENTOS)
self.assertEqual(hpccm.config.g_linux_version, StrictVersion('7.0'))
def test_detect_ubuntu(self):
"""Base image Linux distribution detection"""
b = baseimage(image='ubuntu:sixteen')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, StrictVersion('16.04'))
def test_invalid_ctype(self):
"""Invalid container type specified"""
b = baseimage()
with self.assertRaises(RuntimeError):
str(b)
def test_detect_ppc64le(self):
"""Base image CPU architecture detection"""
b = baseimage(image='ppc64le/centos:7')
self.assertEqual(hpccm.config.g_cpu_arch, cpu_arch.PPC64LE)
def test_value_singularity(self):
"""Image name is specified"""
b = baseimage(image='foo')
self.assertEqual(str(b),
r'''BootStrap: docker
From: foo
def test_detect_centos_8(self):
"""Base image Linux distribution detection"""
b = baseimage(image='centos:8')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.CENTOS)
self.assertEqual(hpccm.config.g_linux_version, StrictVersion('8.0'))
def test_detect_ubi7(self):
"""Base image Linux distribution detection"""
b = baseimage(image='nvidia/cuda:10.1-devel-ubi7')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.RHEL)
self.assertEqual(hpccm.config.g_linux_version, StrictVersion('7.0'))
def test_detect_ubuntu16(self):
"""Base image Linux distribution detection"""
b = baseimage(image='nvidia/cuda:9.0-devel-ubuntu16.04')
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
self.assertEqual(hpccm.config.g_linux_version, StrictVersion('16.04'))
def test_arch_aarch64(self):
"""Base image CPU architecture specification"""
b = baseimage(image='foo', _arch='aarch64')
self.assertEqual(hpccm.config.g_cpu_arch, cpu_arch.AARCH64)
def test_as_singularity26(self):
"""Docker specified image naming"""
b = baseimage(image='foo', _as='dev')
self.assertEqual(str(b),
r'''BootStrap: docker
From: foo