MCPcopy
hub / github.com/pytest-dev/pytest / test_gethash

Method test_gethash

testing/_py/test_local.py:574–584  ·  view source on GitHub ↗
(self, tmpdir)

Source from the content-addressed store, hash-verified

572 assert tmpdir.dirpath("/bar", abs=True) == local("/bar")
573
574 def test_gethash(self, tmpdir):
575 from hashlib import md5
576 from hashlib import sha1 as sha
577
578 fn = tmpdir.join("testhashfile")
579 data = b"hello"
580 fn.write(data, mode="wb")
581 assert fn.computehash("md5") == md5(data).hexdigest()
582 assert fn.computehash("sha1") == sha(data).hexdigest()
583 with pytest.raises(ValueError):
584 fn.computehash("asdasd")
585
586 def test_remove_removes_readonly_file(self, tmpdir):
587 readonly_file = tmpdir.join("readonly").ensure()

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
computehashMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected