Skip to content

Commit

Permalink
Unit Tests: Temporary file handles need to be closed explicitly under…
Browse files Browse the repository at this point in the history
… Windows
  • Loading branch information
Stefan Bisplinghoff committed Mar 16, 2017
1 parent f6d1193 commit f0c066a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/test_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@ def test_baseFeed(self):

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):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ def test_feed(self):

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)

0 comments on commit f0c066a

Please sign in to comment.