From 483d5b1edd02096f21ae9d99c3d4cb044f9467a5 Mon Sep 17 00:00:00 2001 From: Dillon Stadther Date: Mon, 23 Jul 2018 15:52:02 -0400 Subject: [PATCH 1/3] Update moto to 1.x milestone version --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index ecf04f8d13..48f3d6bb0c 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ usedevelop = True install_command = pip install {opts} {packages} deps= mock<2.0 - moto<1.0 + moto<2.0 HTTPretty==0.8.10 nose<2.0 docker>=2.1.0 From bd18c103f069311bf11f5b6f410f27745feb2a2f Mon Sep 17 00:00:00 2001 From: Dillon Stadther Date: Tue, 14 Aug 2018 09:24:24 -0400 Subject: [PATCH 2/3] Extract s3 remote path to variable --- test/contrib/s3_test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/contrib/s3_test.py b/test/contrib/s3_test.py index 97ea5cfc2e..400088a630 100644 --- a/test/contrib/s3_test.py +++ b/test/contrib/s3_test.py @@ -101,8 +101,9 @@ def test_read_iterator_long(self): client = S3Client(AWS_ACCESS_KEY, AWS_SECRET_KEY) create_bucket() - client.put(temppath, 's3://mybucket/largetempfile') - t = S3Target('s3://mybucket/largetempfile', client=client) + remote_path = 's3://mybucket/largetempfile' + client.put(temppath, remote_path) + t = S3Target(remote_path, client=client) with t.open() as read_file: lines = [line for line in read_file] finally: From 36168dda504be25d6bcd89e524aa27b8fbd25d86 Mon Sep 17 00:00:00 2001 From: Dillon Stadther Date: Tue, 14 Aug 2018 09:25:04 -0400 Subject: [PATCH 3/3] Extract line 2 and 3 to variables; add linesep to line 3 to prevent premature file closing --- test/contrib/s3_test.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/contrib/s3_test.py b/test/contrib/s3_test.py index 400088a630..9bb7728928 100644 --- a/test/contrib/s3_test.py +++ b/test/contrib/s3_test.py @@ -95,7 +95,9 @@ def test_read_iterator_long(self): tempf = tempfile.NamedTemporaryFile(mode='wb', delete=False) temppath = tempf.name firstline = ''.zfill(key.Key.BufferSize * 5) + os.linesep - contents = firstline + 'line two' + os.linesep + 'line three' + secondline = 'line two' + os.linesep + thirdline = 'line three' + os.linesep + contents = firstline + secondline + thirdline tempf.write(contents.encode('utf-8')) tempf.close() @@ -111,8 +113,8 @@ def test_read_iterator_long(self): self.assertEqual(3, len(lines)) self.assertEqual(firstline, lines[0]) - self.assertEqual("line two" + os.linesep, lines[1]) - self.assertEqual("line three", lines[2]) + self.assertEqual(secondline, lines[1]) + self.assertEqual(thirdline, lines[2]) def test_get_path(self): t = self.create_target()