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

Tests failing when using django-storages (S3BotoStorage) #1542

Closed
salvadormrf opened this issue Jul 22, 2015 · 2 comments
Closed

Tests failing when using django-storages (S3BotoStorage) #1542

salvadormrf opened this issue Jul 22, 2015 · 2 comments

Comments

@salvadormrf
Copy link
Contributor

requirements

boto==2.38.0
django-storages==1.1.8

settings

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_S3_SECURE_URLS = True       # use http instead of https
AWS_QUERYSTRING_AUTH = False    # don't add complex authentication-related querying

AWS_S3_ACCESS_KEY_ID = 'MY-KEY'
AWS_S3_SECRET_ACCESS_KEY = 'MY-SECRET'
AWS_STORAGE_BUCKET_NAME = 'MY-BUCKET'

result

python runtests.py wagtail.wagtailimages --failfast

======================================================================
FAIL: test_closes_image (wagtail.wagtailimages.tests.test_models.TestGetWillowImage)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/wagtail-1.0/wagtail/wagtailimages/tests/test_models.py", line 239, in test_closes_image
    self.assertTrue(self.image.file.closed)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 4 tests in 2.563s

FAILED (failures=1)
Destroying test database for alias 'default'...
@kaedroho
Copy link
Contributor

This looks like a bug in django-storages to me.

When you call file.close() the file.closed property should return True.

django-storages doesn't override djangos default definition of this property: https://github.com/django/django/blob/master/django/core/files/base.py#L67-L69

This tells if the file is closed by simply accessing the .file attribute. But in django-storages, this reopens the file: https://github.com/jschneier/django-storages/blob/master/storages/backends/s3boto.py#L120-L138

So .closed returns False

@kaedroho
Copy link
Contributor

Closing as this isn't a Wagtail bug

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

No branches or pull requests

2 participants