Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource Warning in unit tests #513

Closed
rawrgulmuffins opened this issue Apr 12, 2014 · 8 comments
Closed

Resource Warning in unit tests #513

rawrgulmuffins opened this issue Apr 12, 2014 · 8 comments
Labels

Comments

@rawrgulmuffins
Copy link

Cloned Werkzeug just a little bit ago and ran run-tests.py and saw these pop up.
Reported Error:

/Users/alord/flask/werkzeug/werkzeug/werkzeug/wsgi.py:802: ResourceWarning:   
unclosed file <_io.FileIO name=5 mode='rb+'> iter = chain((first_item,), _iter)

/Users/happy/flask/werkzeug/werkzeug/werkzeug/http.py:332: ResourceWarning: 
unclosed file <_io.FileIO name=5 mode='rb+'> extra = dict(parts)

Environment Information:
OS X 10.8.5 (12F45)
XTools
Python3.4
WerkZeug (cloned Today, I believe that makes it 0.10Dev but unsure)

@untitaker
Copy link
Contributor

I can reproduce this.

@untitaker
Copy link
Contributor

And now i can't with py.test -s (which is supposed to disable all stdout capturing)

Closing this for now.

@untitaker
Copy link
Contributor

During my work on #434 i saw them again.

@untitaker untitaker reopened this Aug 24, 2014
@untitaker
Copy link
Contributor

It is possible that 8f65855 fixed this.

@untitaker untitaker added this to the 1.0 milestone Aug 25, 2014
@untitaker untitaker added the bug label Aug 26, 2014
@ramschmaerchen
Copy link

Still there, bug might be flask related:

Python 3.5.2
Flask==0.11.1
# unittest
def setUp(self):
    self.app = frontend.app.test_client()
def test_sass_route(self):
    page = self.app.get("static/foo.css")
    self.assertEqual(page.status_code, 200)
# unittest output
test_css_route (tests.router.AssetRoutingTest) ... Python.framework/Versions/3.5/lib/python3.5/unittest/case.py:600: ResourceWarning: unclosed file <_io.BufferedReader name='static/foo.css'>
  testMethod()
__ok__

Test runs successfully and OS file access output suggests the file gets closed before the python application quits.

@jab
Copy link
Member

jab commented Mar 18, 2017

I'm fixing a bug on latest master and seeing this in a test I'm adding. Any known workarounds?

@ramschmaerchen
Copy link

ramschmaerchen commented Mar 18, 2017

I decided to use "ignore" as workaround. Would be thrilled if you have the time to fix this!

@davidism
Copy link
Member

This is very old and I can't reproduce it. I know people are reporting that this is still happening, if you have a concrete test case with Werkzeug (or from its tests), please open a new issue with exact details.

@davidism davidism removed this from the 1.0 milestone Nov 22, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants