def test_mpi_attr(comm): if comm.rank == 0: fname = tempfile.mkdtemp() fname = comm.bcast(fname) else: fname = comm.bcast(None) x = BigFileMPI(comm, fname, create=True) with x.create('.', dtype=None) as b: b.attrs['int'] = 128 b.attrs['float'] = [128.0, 3, 4] b.attrs['string'] = 'abcdefg' with x.open('.') as b: assert_equal(b.attrs['int'], 128) assert_equal(b.attrs['float'], [128.0, 3, 4]) assert_equal(b.attrs['string'], 'abcdefg') b.attrs['int'] = 30 b.attrs['float'] = [3, 4] b.attrs['string'] = 'defg' with x.open('.') as b: assert_equal(b.attrs['int'], 30) assert_equal(b.attrs['float'], [3, 4]) assert_equal(b.attrs['string'], 'defg') comm.barrier() if comm.rank == 0: shutil.rmtree(fname)