Hello, some conditions in RlimitRule can never be hit under normal circumstances, so this patch adds some "pragma: no cover" and "pragma: no branch" comments to beautify the coverage report.
[ 01-rlimit-coverage-pragma.diff ]
=== modified file ./utils/apparmor/rule/rlimit.py
--- utils/apparmor/rule/rlimit.py 2016-10-01 20:33:23.421684000 +0200
+++ utils/apparmor/rule/rlimit.py 2016-11-08 17:29:36.237899601 +0100
@@ -96,7 +96,7 @@
else:
self.value_as_int = self.time_to_int(value, 'seconds')
- elif rlimit in rlimit_nice:
+ elif rlimit in rlimit_nice: # pragma: no branch - "if rlimit in
rlimit_all:" above avoids the need for an "else:" branch
if not RE_NICE.match(value):
raise AppArmorException('Invalid value or unit in rlimit
%s %s rule' % (rlimit, value))
self.value_as_int = 0 - int(value) # lower numbers mean a
higher limit for nice
@@ -123,7 +123,7 @@
if matches.group('rlimit'):
rlimit = strip_quotes(matches.group('rlimit'))
else:
- raise AppArmorException(_("Invalid rlimit rule '%s' - keyword
missing") % raw_rule)
+ raise AppArmorException(_("Invalid rlimit rule '%s' - keyword
missing") % raw_rule) # pragma: no cover - would need breaking the regex
if matches.group('value'):
if matches.group('value') == 'infinity':
@@ -131,7 +131,7 @@
else:
value = strip_quotes(matches.group('value'))
else:
- raise AppArmorException(_("Invalid rlimit rule '%s' - value
missing") % raw_rule)
+ raise AppArmorException(_("Invalid rlimit rule '%s' - value
missing") % raw_rule) # pragma: no cover - would need breaking the regex
return RlimitRule(rlimit, value,
comment=comment)
Regards,
Christian Boltz
--
Also, monolithisch im Sinne von "das macht einfach alles und streichelt
auch noch die Katze", nicht im Sinne von einem großen Code Blob.
[Andreas Scherbaum über systemd auf
https://plus.google.com/117024231055768477646/posts/7tJUsZidkr6]
signature.asc
Description: This is a digitally signed message part.
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
