Skip to content

Commit

Permalink
Fix resource warnings in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Dec 4, 2019
1 parent f292593 commit ea25531
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/zope/app/wsgi/fileresult.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ You can suppress this behavior by setting the content length yourself:
Note that you should really only use file returns for large results.
Files use file descriptors which can be somewhat scarce resources on
some systems. Only use them when you need them.

>>> t.close()
>>> f.close()
4 changes: 2 additions & 2 deletions src/zope/app/wsgi/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def __call__(self):
fn = tempfile.mktemp()
with open(fn, 'wb') as file:
file.write(b"Hello\nWorld!\n")
file = open(fn, 'rb')
return file
with open(fn, 'rb') as file:
return file.read()


class IndexView(FileView):
Expand Down

0 comments on commit ea25531

Please sign in to comment.