def test_put(hdfs): data = b'1234567890' * 10000 with tmpfile() as fn: with open(fn, 'wb') as f: f.write(data) hdfs.put(fn, a) assert hdfs.cat(a) == data
def test_getmerge(hdfs): with hdfs.open(a, 'wb', replication=1) as f: f.write(b'123') with hdfs.open(b, 'wb', replication=1) as f: f.write(b'456') with tmpfile() as fn: hdfs.getmerge('/tmp/test', fn) with open(fn, 'rb') as f: data = f.read() assert data == b'123456'
def test_getmerge(hdfs): with hdfs.open(a, 'wb') as f: f.write(b'123') with hdfs.open(b, 'wb') as f: f.write(b'456') with tmpfile() as fn: hdfs.getmerge('/tmp/test', fn) with open(fn, 'rb') as f: data = f.read() assert data == b'123456'
def test_get(hdfs): data = b'1234567890' with tmpfile() as fn: with hdfs.open(a, 'wb', replication=1) as f: f.write(data) hdfs.get(a, fn) with open(fn, 'rb') as f: data2 = f.read() assert data2 == data with pytest.raises(IOError): hdfs.get(b, fn)
def test_get(hdfs): data = b'1234567890' with tmpfile() as fn: with hdfs.open(a, 'wb') as f: f.write(data) hdfs.get(a, fn) with open(fn, 'rb') as f: data2 = f.read() assert data2 == data with pytest.raises(IOError): hdfs.get(b, fn)