MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / reset_fixture

Function reset_fixture

tools/materialize-bench/imported_guest.py:198–214  ·  view source on GitHub ↗
(root, backend, manifest, case)

Source from the content-addressed store, hash-verified

196
197
198def reset_fixture(root, backend, manifest, case):
199 repo = root / backend
200 shutil.copyfile(root / (backend + '-baseline.redb'), repo / '.atomic/atomic.redb')
201 for index, file in enumerate(manifest['files']):
202 path = repo / file['path']
203 if path.exists() or path.is_symlink():
204 if path.is_dir() and not path.is_symlink():
205 raise ValueError('refusing to remove directory: ' + str(path))
206 path.unlink()
207 if case == 'render':
208 path.parent.mkdir(parents=True, exist_ok=True)
209 content = (root / 'golden' / str(index)).read_bytes()
210 if file['mode'] == '120000':
211 path.symlink_to(os.fsdecode(content))
212 else:
213 path.write_bytes(content)
214 path.chmod(0o755 if file['mode'] == '100755' else 0o644)
215
216
217def meminfo():

Callers 1

measureFunction · 0.85

Calls 2

is_dirMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected