From f206c3d49334694ad7ceb44306089000b16ed7fb Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 16 Apr 2014 00:30:46 -0400 Subject: [PATCH] BF: give a custom prefix to a tempfile and close it upon tearDown in ExecuteActions tests --- testcases/actionstestcase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testcases/actionstestcase.py b/testcases/actionstestcase.py index 15877749..ae123417 100644 --- a/testcases/actionstestcase.py +++ b/testcases/actionstestcase.py @@ -35,9 +35,10 @@ class ExecuteActions(unittest.TestCase): """Call before every test case.""" self.__jail = DummyJail() self.__actions = Actions(self.__jail) - self.__tmpfile, self.__tmpfilename = tempfile.mkstemp() + self.__tmpfile, self.__tmpfilename = tempfile.mkstemp('fail2ban', 'executeactions') def tearDown(self): + os.close(self.__tmpfile) os.remove(self.__tmpfilename) def defaultActions(self):