Skip to content

Commit 8b6a3b3

Browse files
author
Vasileios Karakasis
authored
Merge pull request #805 from vkarak/refactor/fix-abstract-classes
[refactor] Fix abstract class definitions
2 parents 1a7ff13 + 1a530cb commit 8b6a3b3

File tree

6 files changed

+9
-12
lines changed

6 files changed

+9
-12
lines changed

reframe/core/buildsystems.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from reframe.core.exceptions import BuildSystemError
77

88

9-
class BuildSystem:
9+
class BuildSystem(abc.ABC):
1010
"""The abstract base class of any build system.
1111
1212
Concrete build systems inherit from this class and must override the

reframe/frontend/executors/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def abort(self, cause=None):
212212
self.fail((type(exc), exc, None))
213213

214214

215-
class TaskEventListener:
215+
class TaskEventListener(abc.ABC):
216216
@abc.abstractmethod
217217
def on_task_run(self, task):
218218
"""Called whenever the run() method of a RegressionTask is called."""
@@ -320,7 +320,7 @@ def print_separator(check, prefix):
320320
self._policy.exit()
321321

322322

323-
class ExecutionPolicy:
323+
class ExecutionPolicy(abc.ABC):
324324
"""Base abstract class for execution policies.
325325
326326
An execution policy implements the regression check pipeline."""
@@ -369,7 +369,3 @@ def runcase(self, case):
369369

370370
if self.force_local:
371371
case.check.local = True
372-
373-
@abc.abstractmethod
374-
def getstats(self):
375-
"""Return test case statistics of the run."""

reframe/utility/versioning.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __str__(self):
6767
return base + '-dev%s' % self._dev_number
6868

6969

70-
class _ValidatorImpl:
70+
class _ValidatorImpl(abc.ABC):
7171
"""Abstract base class for the validation of version ranges."""
7272
@abc.abstractmethod
7373
def validate(version):
@@ -81,6 +81,7 @@ class _IntervalValidator(_ValidatorImpl):
8181
``validate`` returns ``True`` if a given version string is inside
8282
the interval including the endpoints.
8383
"""
84+
8485
def __init__(self, condition):
8586
try:
8687
min_version_str, max_version_str = condition.split('..')
@@ -108,6 +109,7 @@ class _RelationalValidator(_ValidatorImpl):
108109
``<bool_operator><version>``, and its method ``validate`` returns
109110
``True`` if a given version string satisfies the relation.
110111
"""
112+
111113
def __init__(self, condition):
112114
self._op_actions = {
113115
">": lambda x, y: x > y,

unittests/test_buildsystems.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from reframe.core.exceptions import BuildSystemError
77

88

9-
class _BuildSystemTest:
9+
class _BuildSystemTest(abc.ABC):
1010
@abc.abstractmethod
1111
def create_build_system(self):
1212
pass

unittests/test_modules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from unittests.fixtures import TEST_MODULES
1111

1212

13-
class _TestModulesSystem:
13+
class _TestModulesSystem(abc.ABC):
1414
def setUp(self):
1515
self.environ_save = EnvironmentSnapshot()
1616
self.modules_system.searchpath_add(TEST_MODULES)

unittests/test_schedulers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from reframe.core.schedulers.slurm import SlurmNode
1919

2020

21-
class _TestJob:
21+
class _TestJob(abc.ABC):
2222
def setUp(self):
2323
self.workdir = tempfile.mkdtemp(dir='unittests')
2424
self.testjob = self.job_type(
@@ -71,7 +71,6 @@ def setup_user(self, msg=None):
7171

7272
self.testjob.options += partition.access
7373

74-
@abc.abstractmethod
7574
def assertScriptSanity(self, script_file):
7675
"""Assert the sanity of the produced script file."""
7776
with open(self.testjob.script_filename) as fp:

0 commit comments

Comments
 (0)