From 1bdda6c8eb497990b0c000947d6cdd0e3aa4e5cb Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 2 Mar 2018 20:08:48 +0100 Subject: [PATCH] cache coverage --- fail2ban/server/utils.py | 2 +- fail2ban/tests/filtertestcase.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fail2ban/server/utils.py b/fail2ban/server/utils.py index 58363ff0..8569a3f2 100644 --- a/fail2ban/server/utils.py +++ b/fail2ban/server/utils.py @@ -102,7 +102,7 @@ class Utils(): def unset(self, k): try: del self._cache[k] - except KeyError: # pragme: no cover + except KeyError: pass diff --git a/fail2ban/tests/filtertestcase.py b/fail2ban/tests/filtertestcase.py index b5877b7f..2bbfcd9d 100644 --- a/fail2ban/tests/filtertestcase.py +++ b/fail2ban/tests/filtertestcase.py @@ -1640,6 +1640,8 @@ class DNSUtilsTests(unittest.TestCase): c.set(i, i) for i in xrange(5): self.assertEqual(c.get(i), i) + # remove unavailable key: + c.unset('a'); c.unset('a') def testCacheMaxSize(self): c = Utils.Cache(maxCount=5, maxTime=60)