Skip to content

Commit

Permalink
Use python2 compatible compress function
Browse files Browse the repository at this point in the history
  • Loading branch information
skruger committed Jul 12, 2018
1 parent bb9bd54 commit 726b2ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/test_s3boto.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import datetime
import os
import gzip
import zlib

from boto.exception import S3ResponseError
from boto.s3.key import Key
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_storage_save_gzipped(self):
Test saving a gzipped file
"""
name = 'test_storage_save.gz'
compressed_data = gzip.compress("I am gzip'd".encode('utf8'))
compressed_data = zlib.compress("I am gzip'd".encode('utf8'))
content = ContentFile(compressed_data)
self.storage.detect_content_encoding = False
self.storage.save(name, content)
Expand All @@ -114,7 +114,7 @@ def test_storage_save_gzip_encoded(self):
Test saving a gzipped file
"""
name = 'test_storage_save.gz'
compressed_data = gzip.compress("I am gzip'd".encode('utf8'))
compressed_data = zlib.compress("I am gzip'd".encode('utf8'))
content = ContentFile(compressed_data)
self.storage.detect_content_encoding = True
self.storage.save(name, content)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_s3boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import unicode_literals

import gzip
import zlib
import threading
from datetime import datetime
from unittest import skipIf
Expand Down Expand Up @@ -114,7 +115,7 @@ def test_storage_save_gzipped(self):
Test saving a gzipped file
"""
name = 'test_storage_save.gz'
compressed_data = gzip.compress("I am gzip'd".encode('utf8'))
compressed_data = zlib.compress("I am gzip'd".encode('utf8'))
content = ContentFile(compressed_data)
self.storage.detect_content_encoding = False
self.storage.save(name, content)
Expand All @@ -132,7 +133,7 @@ def test_storage_save_gzip_encoded(self):
Test saving a gzipped file
"""
name = 'test_storage_save.gz'
compressed_data = gzip.compress("I am gzip'd".encode('utf8'))
compressed_data = zlib.compress("I am gzip'd".encode('utf8'))
content = ContentFile(compressed_data)
self.storage.detect_content_encoding = True
self.storage.save(name, content)
Expand Down

0 comments on commit 726b2ca

Please sign in to comment.