def test_vtk(self, request, tmp_path, ref_path, update, patch_execution_stamp, patch_datetime_now, output, fname, inc): result = Result(ref_path / fname).view('increments', inc) os.chdir(tmp_path) result.export_VTK(output) fname = fname.split( '.')[0] + f'_inc{(inc if type(inc) == int else inc[0]):0>2}.vti' last = '' for i in range(10): if os.path.isfile(tmp_path / fname): with open(fname) as f: cur = hashlib.md5(f.read().encode()).hexdigest() if cur == last: break else: last = cur time.sleep(.5) if update: with open((ref_path / 'export_VTK' / request.node.name).with_suffix('.md5'), 'w') as f: f.write(cur) with open((ref_path / 'export_VTK' / request.node.name).with_suffix('.md5')) as f: assert cur == f.read()
def test_vtk(self, request, tmp_path, ref_path, update, patch_execution_stamp, patch_datetime_now, output, fname, inc): result = Result(ref_path / fname).view(increments=inc) os.chdir(tmp_path) result.export_VTK(output, parallel=False) fname = fname.split( '.')[0] + f'_inc{(inc if type(inc) == int else inc[0]):0>2}.vti' v = VTK.load(tmp_path / fname) v.set_comments('n/a') v.save(tmp_path / fname, parallel=False) with open(fname) as f: cur = hashlib.md5(f.read().encode()).hexdigest() if update: with open((ref_path / 'export_VTK' / request.node.name).with_suffix('.md5'), 'w') as f: f.write(cur + '\n') with open((ref_path / 'export_VTK' / request.node.name).with_suffix('.md5')) as f: assert cur == f.read().strip('\n')
def test_vtk_marc(self, tmp_path, ref_path, mode, output): os.chdir(tmp_path) result = Result(ref_path / 'check_compile_job1.hdf5') result.export_VTK(output, mode)