Skip to content

Commit 5888594

Browse files
committed
issue #615: another Py3x fix.
1 parent 9e1e1ba commit 5888594

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/ansible/tests/connection_test.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ def test_is_junk(self):
101101

102102
class FetchFileTest(ConnectionMixin, testlib.TestCase):
103103
def test_success(self):
104-
with tempfile.NamedTemporaryFile(prefix='mitotest') as ifp, \
105-
tempfile.NamedTemporaryFile(prefix='mitotest') as ofp:
106-
ifp.write(b'x' * (1048576 * 4))
107-
ifp.flush()
108-
ifp.seek(0)
109-
110-
self.conn.fetch_file(ifp.name, ofp.name)
111-
# transfer_file() uses os.rename rather than direct data overwrite,
112-
# so we must reopen.
113-
with open(ofp.name, 'rb') as fp:
114-
self.assertEquals(ifp.read(), fp.read())
104+
with tempfile.NamedTemporaryFile(prefix='mitotest') as ifp:
105+
with tempfile.NamedTemporaryFile(prefix='mitotest') as ofp:
106+
ifp.write(b'x' * (1048576 * 4))
107+
ifp.flush()
108+
ifp.seek(0)
109+
110+
self.conn.fetch_file(ifp.name, ofp.name)
111+
# transfer_file() uses os.rename rather than direct data
112+
# overwrite, so we must reopen.
113+
with open(ofp.name, 'rb') as fp:
114+
self.assertEquals(ifp.read(), fp.read())
115115

116116

117117
class PutDataTest(ConnectionMixin, testlib.TestCase):

0 commit comments

Comments
 (0)