Use a set for pre_hook.already

This commit is contained in:
Brad Warren 2017-01-04 12:57:54 -08:00
parent b748f1afe4
commit 458c7c8131
2 changed files with 3 additions and 3 deletions

View file

@ -54,11 +54,11 @@ def pre_hook(config):
if cmd and cmd not in pre_hook.already:
logger.info("Running pre-hook command: %s", cmd)
_run_hook(cmd)
pre_hook.already[cmd] = True
pre_hook.already.add(cmd)
elif cmd:
logger.info("Pre-hook command already run, skipping: %s", cmd)
pre_hook.already = {}
pre_hook.already = set()
def post_hook(config):

View file

@ -47,7 +47,7 @@ class HookTest(unittest.TestCase):
return mock_logger.warning
def test_pre_hook(self):
hooks.pre_hook.already = {}
hooks.pre_hook.already = set()
config = mock.MagicMock(pre_hook="true")
self._test_a_hook(config, hooks.pre_hook, 1)
self._test_a_hook(config, hooks.pre_hook, 0)