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.hromatka@oracle.com>
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
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)
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