Skip to content

Commit c7b09d3

Browse files
committed
fix comments
1 parent d27a37d commit c7b09d3

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

reframe/core/containers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from reframe.core.exceptions import ContainerError
66

77

8-
class ContainerPlatform:
8+
class ContainerPlatform(abc.ABC):
99
"""The abstract base class of any container platform.
1010
1111
Concrete container platforms inherit from this class and must override the
@@ -64,28 +64,29 @@ def validate(self):
6464
platforms.
6565
"""
6666
if self.image is None:
67-
raise ContainerError('no image specified.')
67+
raise ContainerError('no image specified')
6868

6969
if not self.commands:
70-
raise ContainerError('no command specified')
70+
raise ContainerError('no commands specified')
7171

7272

7373
class Docker(ContainerPlatform):
74-
"""An implementation of ContainerPlatform to run containers with
75-
Docker.
76-
"""
74+
"""An implementation of ContainerPlatform to run containers with Docker."""
7775
def emit_prepare_cmds(self):
7876
pass
7977

80-
def emit_launch_commands(self):
78+
def emit_launch_cmds(self):
8179
super().emit_launch_cmds()
82-
docker_opts = []
8380
docker_opts = ['-v "%s":"%s"' % mp for mp in self.mount_points]
8481
run_cmd = 'docker run %s %s bash -c ' % (' '.join(docker_opts),
8582
self.image)
8683
return run_cmd + "'" + '; '.join(
8784
['cd ' + self.workdir] + self.commands) + "'"
8885

86+
def validate(self):
87+
super().validate()
88+
pass
89+
8990

9091
class ContainerPlatformField(fields.TypedField):
9192
"""A field representing a container platforms.

unittests/test_containers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from reframe.core.exceptions import ContainerError
77

88

9-
class _ContainerPlatformTest:
9+
class _ContainerPlatformTest(abc.ABC):
1010
@abc.abstractmethod
1111
def create_container_platform(self):
1212
pass
@@ -30,8 +30,8 @@ def test_mount_points(self):
3030
('/path/two', '/two')]
3131
self.container_platform.commands = ['cmd1', 'cmd2']
3232
self.container_platform.workdir = '/stagedir'
33-
self.assertEqual(self.exp_cmd_mount_points,
34-
self.container_platform.emit_launch_commands())
33+
assert (self.exp_cmd_mount_points ==
34+
self.container_platform.emit_launch_cmds())
3535

3636
def test_missing_image(self):
3737
self.container_platform.commands = ['cmd']
@@ -49,8 +49,8 @@ def test_custom_registry(self):
4949
self.container_platform.commands = ['cmd']
5050
self.container_platform.mount_points = [('/path/one', '/one')]
5151
self.container_platform.workdir = '/stagedir'
52-
self.assertEqual(self.exp_cmd_custom_registry,
53-
self.container_platform.emit_launch_commands())
52+
assert (self.exp_cmd_custom_registry ==
53+
self.container_platform.emit_launch_cmds())
5454

5555

5656
class TestDocker(_ContainerPlatformTest, unittest.TestCase):

0 commit comments

Comments
 (0)