issue #615: another Py3x fix.

pull/618/head
David Wilson 5 years ago
parent 9e1e1ba015
commit 588859423a

@ -101,17 +101,17 @@ class OptionalIntTest(testlib.TestCase):
class FetchFileTest(ConnectionMixin, testlib.TestCase): class FetchFileTest(ConnectionMixin, testlib.TestCase):
def test_success(self): def test_success(self):
with tempfile.NamedTemporaryFile(prefix='mitotest') as ifp, \ with tempfile.NamedTemporaryFile(prefix='mitotest') as ifp:
tempfile.NamedTemporaryFile(prefix='mitotest') as ofp: with tempfile.NamedTemporaryFile(prefix='mitotest') as ofp:
ifp.write(b'x' * (1048576 * 4)) ifp.write(b'x' * (1048576 * 4))
ifp.flush() ifp.flush()
ifp.seek(0) ifp.seek(0)
self.conn.fetch_file(ifp.name, ofp.name) self.conn.fetch_file(ifp.name, ofp.name)
# transfer_file() uses os.rename rather than direct data overwrite, # transfer_file() uses os.rename rather than direct data
# so we must reopen. # overwrite, so we must reopen.
with open(ofp.name, 'rb') as fp: with open(ofp.name, 'rb') as fp:
self.assertEquals(ifp.read(), fp.read()) self.assertEquals(ifp.read(), fp.read())
class PutDataTest(ConnectionMixin, testlib.TestCase): class PutDataTest(ConnectionMixin, testlib.TestCase):

Loading…
Cancel
Save