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_arch_nonexistent(self):
"""Base image CPU architecture specification"""
b = baseimage(image='foo', _arch='nonexistent')
self.assertEqual(hpccm.config.g_cpu_arch, cpu_arch.X86_64)
def test_apptest_singularity(self):
"""test option"""
cmds = ['a', 'b', 'c']
s = shell(commands=cmds, _app='foo', chdir=False, _test=True)
self.assertEqual(str(s), '%apptest foo\n a\n b\n c')
def test_single_docker(self):
"""Single environment variable specified"""
e = environment(variables={'A': 'B'}, _export=False)
self.assertEqual(str(e), 'ENV A=B')
def test_single_export_docker(self):
"""Single environment variable specified"""
e = environment(variables={'A': 'B'})
self.assertEqual(str(e), 'ENV A=B')
def test_appenv_multiple_singularity(self):
"""Multiple app-specific environment variables specified"""
e = environment(variables={'ONE': 1, 'TWO': 2, 'THREE': 3},
_app='foo')
self.assertEqual(str(e),
'''%appenv foo
export ONE=1
def test_merge_file_singularity(self):
"""merge primitives"""
c = []
c.append(copy(src='a', dest='A'))
c.append(copy(src='b', dest='B'))
merged = c[0].merge(c)
self.assertEqual(str(merged), '%files\n a A\n b B')
def test_multiple_docker(self):
"""Multiple source files specified"""
c = copy(src=['a1', 'a2', 'a3'], dest='b')
self.assertEqual(str(c), 'COPY a1 \\\n a2 \\\n a3 \\\n b/')
def test_appfiles_files_singularity(self):
"""Pairs of app-specific files specified"""
c = copy(files={'a1': 'b1', 'a2': 'b2', 'a3': 'b3'}, _app='foo')
self.assertEqual(str(c),
'%appfiles foo\n a1 b1\n a2 b2\n a3 b3')
def test_appfiles_multiple_singularity(self):
"""Multiple app-specific source files specified"""
c = copy(src=['a1', 'a2', 'a3'], dest='b', _app='foo')
self.assertEqual(str(c),
'%appfiles foo\n a1 b\n a2 b\n a3 b')
def test_invalid_ctype(self):
"""Invalid container type specified"""
c = copy(src='a', dest='b')
with self.assertRaises(RuntimeError):
str(c)