def test_datasink_localcopy(dummy_input, tmpdir):
 local_dir = str(tmpdir)
 container = u'outputs'
 attr_folder = u'text_file'
 input_path = dummy_input
 ds = nio.DataSink()
 ds.inputs.container = container
 ds.inputs.local_copy = local_dir
 setattr(ds.inputs, attr_folder, input_path)
 local_copy = os.path.join(local_dir, container, attr_folder, os.path.basename(input_path))
 ds.run()
 src_md5 = hashlib.md5(open(input_path, u'rb').read()).hexdigest()
 dst_md5 = hashlib.md5(open(local_copy, u'rb').read()).hexdigest()
 assert (src_md5 == dst_md5)

def test_datasink_localcopy ( dummy_input , tmpdir ) : local_dir = str ( tmpdir ) container = u'outputs' attr_folder = u'text_file' input_path = dummy_input ds = nio . DataSink ( ) ds . inputs . container = container ds . inputs . local_copy = local_dir setattr ( ds . inputs , attr_folder , input_path ) local_copy = os . path . join ( local_dir , container , attr_folder , os . path . basename ( input_path ) ) ds . run ( ) src_md5 = hashlib . md5 ( open ( input_path , u'rb' ) . read ( ) ) . hexdigest ( ) dst_md5 = hashlib . md5 ( open ( local_copy , u'rb' ) . read ( ) ) . hexdigest ( ) assert ( src_md5 == dst_md5 )
function to validate datasink will make local copy via local_copy attribute .