diff options
author | Victor Stinner <victor.stinner@enovance.com> | 2014-03-24 18:18:26 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@enovance.com> | 2014-03-24 18:18:26 +0100 |
commit | 9c85ea7a7521c12bf4ebd8c7bf93fe5928e36a05 (patch) | |
tree | 6deeaba1f0e23e233a020173e45ac315e1d28bcd | |
parent | 070dd48c315b63e9ba75fc1020922222c985b194 (diff) | |
download | python-swiftclient-9c85ea7a7521c12bf4ebd8c7bf93fe5928e36a05.tar.gz |
Python 3: Fix tests using temporary text files
Use mode "w" instead of the default mode "wb+" to get text file instead of
binary file on Python 3.
Change-Id: I2efe8d926309cfcd5ffe4ea963c11799773def73
-rw-r--r-- | tests/test_utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index 22af6ac..4c4b29d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -133,7 +133,7 @@ class TestLengthWrapper(testtools.TestCase): self.assertEqual('a' * 42, read_data) def test_tempfile(self): - with tempfile.NamedTemporaryFile() as f: + with tempfile.NamedTemporaryFile(mode='w') as f: f.write('a' * 100) f.flush() contents = open(f.name) @@ -144,7 +144,7 @@ class TestLengthWrapper(testtools.TestCase): self.assertEqual('a' * 42, read_data) def test_segmented_file(self): - with tempfile.NamedTemporaryFile() as f: + with tempfile.NamedTemporaryFile(mode='w') as f: segment_length = 1024 segments = ('a', 'b', 'c', 'd') for c in segments: |