In the ftests and process files, two exceptions were erroneously throwing ValueException rather than ValueError. Fix this.
In CgroupVersion.get_version(), it returned CGROUP_UNK if it couldn't determine the version. Make this method more pythonic by raising a ValueError exception. Signed-off-by: Tom Hromatka <tom.hroma...@oracle.com> --- ftests/cgroup.py | 2 +- ftests/ftests.py | 2 +- ftests/process.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ftests/cgroup.py b/ftests/cgroup.py index 85b160742e3a..76713410ec46 100644 --- a/ftests/cgroup.py +++ b/ftests/cgroup.py @@ -51,7 +51,7 @@ class CgroupVersion(Enum): if ctrl == controller: return CgroupVersion.CGROUP_V2 - return CgroupVersion.CGROUP_UNK + raise IndexError("Unknown version for controller {}".format(controller)) class Cgroup(object): # This class is analogous to libcgroup's struct cgroup diff --git a/ftests/ftests.py b/ftests/ftests.py index a0176ecd2957..139dfb4496e2 100755 --- a/ftests/ftests.py +++ b/ftests/ftests.py @@ -234,7 +234,7 @@ def run_tests(config): elif ret == consts.TEST_SKIPPED: skipped_tests.append([filename, run_time, failure_cause]) else: - raise ValueException('Unexpected ret: {}'.format(ret)) + raise ValueError('Unexpected ret: {}'.format(ret)) passed_cnt = len(passed_tests) failed_cnt = len(failed_tests) diff --git a/ftests/process.py b/ftests/process.py index 6de43a019cc9..1c411954e1c0 100644 --- a/ftests/process.py +++ b/ftests/process.py @@ -81,7 +81,7 @@ class Process(object): pid = pid.splitlines()[1] if pid == "" or int(pid) <= 0: - raise ValueException('Failed to get the pid of the child process: {}'.format(pid)) + raise ValueError('Failed to get the pid of the child process: {}'.format(pid)) self.children.append(p) return pid -- 2.26.2 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel