forked from kenzuya/unshackle
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
import unshackle.core
|
||||
from unshackle.core import __code_hash__, code_files, code_hash
|
||||
from unshackle.core import code_files, code_hash
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
@@ -21,10 +21,6 @@ def test_is_hex_and_stable() -> None:
|
||||
assert first == code_hash()
|
||||
|
||||
|
||||
def test_exported_value_is_the_short_form() -> None:
|
||||
assert __code_hash__ == code_hash()[:7]
|
||||
|
||||
|
||||
def test_covers_the_framework_dirs_only() -> None:
|
||||
rels = code_files()
|
||||
assert "__main__.py" in rels
|
||||
@@ -52,21 +48,6 @@ def test_path_is_part_of_the_hash() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_file_order_does_not_matter_to_the_caller() -> None:
|
||||
"""code_files() sorts, so two orderings of the same set must agree once sorted."""
|
||||
blobs = {"core/a.py": b"x", "core/b.py": b"y"}
|
||||
assert code_hash(files=sorted(blobs), read=blobs.__getitem__) == code_hash(
|
||||
files=sorted(reversed(list(blobs))), read=blobs.__getitem__
|
||||
)
|
||||
|
||||
|
||||
def test_unreadable_source_yields_empty_string() -> None:
|
||||
def unreadable(rel: str) -> bytes:
|
||||
raise PermissionError(rel)
|
||||
|
||||
assert code_hash(files=["core/__init__.py"], read=unreadable) == ""
|
||||
|
||||
|
||||
def test_unwalkable_source_yields_empty_string(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""A dir os.walk cannot enter must yield "", not a valid-looking hash of fewer files."""
|
||||
(tmp_path / "__main__.py").write_bytes(b"")
|
||||
|
||||
Reference in New Issue
Block a user