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

Fix file downloader test #174

Open
philgyford opened this issue Feb 8, 2017 · 0 comments
Open

Fix file downloader test #174

philgyford opened this issue Feb 8, 2017 · 0 comments

Comments

@philgyford
Copy link
Owner

The tests.core.test_utils.FileDownloaderTestCase.test_downloads_file generates this:

======================================================================
ERROR: test_downloads_file (tests.core.test_utils.FileDownloaderTestCase)
Streams a jpg, saves it to /tmp/, returns the path, calls _make_filename_for_download().
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 3, in wrapper
  File "/Users/phil/.pyenv/versions/3.5.1/lib/python3.5/unittest/mock.py", line 1157, in patched
    return func(*args, **keywargs)
  File "/Users/phil/Projects/personal/django-ditto/tests/core/test_utils.py", line 131, in test_downloads_file
    filepath = self.do_download()
  File "/Users/phil/Projects/personal/django-ditto/tests/core/test_utils.py", line 123, in do_download
    return filedownloader.download(self.url, ['image/jpeg'])
  File "/Users/phil/Projects/personal/django-ditto/ditto/core/utils/downloader.py", line 48, in download
    shutil.copyfileobj(r.raw, f)
  File "/Users/phil/Projects/personal/django-ditto/.tox/py35-django110/lib/python3.5/shutil.py", line 73, in copyfileobj
    buf = fsrc.read(length)
  File "/Users/phil/Projects/personal/django-ditto/.tox/py35-django110/lib/python3.5/site-packages/requests/packages/urllib3/response.py", line 380, in read
    data = self._fp.read(amt)
ValueError: I/O operation on closed file.

This happened when requests updated from v2.11.1 to v2.12.0.

No idea quite what's causing that and have spent too long trying to fix it.

http://stackoverflow.com/a/37283060/250962

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant