restore code coverage (decreased in latest "fixes") - no cover for unreachable cases;

pull/2030/merge
sebres 2018-01-24 20:03:46 +01:00
parent ac9d5f61e7
commit 5f3ba289d6
2 changed files with 3 additions and 3 deletions

View File

@ -673,10 +673,10 @@ class LogFileMonitor(LogCaptureTestCase):
failure_was_logged = self._is_logged('Unable to open %s' % self.name)
# verify that we cannot access the file. Checking by name of user is not
# sufficient since could be a fakeroot or some other super-user
is_root = True
try:
with open(self.name) as f:
with open(self.name) as f: # pragma: no cover - normally no root
f.read()
is_root = True
except IOError:
is_root = False

View File

@ -56,7 +56,7 @@ if not CONFIG_DIR:
# Use heuristic to figure out where configuration files are
if os.path.exists(os.path.join('config','fail2ban.conf')):
CONFIG_DIR = 'config'
else:
else: # pragma: no cover - normally unreachable
CONFIG_DIR = '/etc/fail2ban'
# Indicates that we've stock config: