MCPcopy Create free account
hub / github.com/idank/explainshell / test_idempotent

Function test_idempotent

tests/test_postprocess_ubuntu_archive.py:151–167  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

149
150
151def test_idempotent(tmp_path: Path) -> None:
152 src = _make_src(tmp_path)
153 _write(src / "man1" / "tar.1.gz", "tar-data")
154 os.symlink("tar.1.gz", src / "man1" / "gtar.1.gz")
155 os.symlink("nonexistent.1.gz", src / "man1" / "broken.1.gz")
156
157 dst = tmp_path / "dst"
158
159 stats1 = postprocess(src, dst)
160 stats2 = postprocess(src, dst)
161
162 assert stats1 == stats2
163 assert (dst / "1" / "tar.1.gz").read_text() == "tar-data"
164 result = dst / "1" / "gtar.1.gz"
165 assert result.is_symlink()
166 assert os.readlink(result) == "tar.1.gz"
167 assert not (dst / "1" / "broken.1.gz").exists()
168
169
170def test_dry_run(tmp_path: Path) -> None:

Callers

nothing calls this directly

Calls 3

postprocessFunction · 0.90
_make_srcFunction · 0.85
_writeFunction · 0.85

Tested by

no test coverage detected