From f0c066af0f133437cd6f821bd106cef65af7ff10 Mon Sep 17 00:00:00 2001 From: Stefan Bisplinghoff Date: Thu, 16 Mar 2017 16:16:46 +0100 Subject: [PATCH] Unit Tests: Temporary file handles need to be closed explicitly under Windows --- tests/test_feed.py | 3 ++- tests/test_main.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_feed.py b/tests/test_feed.py index 664b3af..ffd8e4b 100644 --- a/tests/test_feed.py +++ b/tests/test_feed.py @@ -134,13 +134,14 @@ class TestSequenceFunctions(unittest.TestCase): def test_atomFeedFile(self): fg = self.fg - _, filename = tempfile.mkstemp() + fh, filename = tempfile.mkstemp() fg.atom_file(filename=filename, pretty=True, xml_declaration=False) with open(filename, "r") as myfile: atomString = myfile.read().replace('\n', '') self.checkAtomString(atomString) + os.close(fh) os.remove(filename) def test_atomFeedString(self): diff --git a/tests/test_main.py b/tests/test_main.py index 7f528ef..a6c6b88 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -31,10 +31,11 @@ class TestSequenceFunctions(unittest.TestCase): def test_file(self): for extemsion in '.atom', '.rss': - _, filename = tempfile.mkstemp(extemsion) + fh, filename = tempfile.mkstemp(extemsion) sys.argv = ['feedgen', filename] try: __main__.main() except: assert False + os.close(fh) os.remove(filename)