Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fix: env/pyvenv.cfg

PHONY: test-python-tuf
test-python-tuf: dev
./env/bin/pytest tuf_conformance \
./env/bin/pytest -v tuf_conformance \
--entrypoint "./env/bin/python ./clients/python-tuf/python_tuf.py" \
--repository-dump-dir $(DUMP_DIR)
@echo Repository dump in $(DUMP_DIR)
Expand All @@ -60,7 +60,7 @@ test-python-tuf: dev

PHONY: test-go-tuf
test-go-tuf: dev build-go-tuf
./env/bin/pytest tuf_conformance \
./env/bin/pytest -v tuf_conformance \
--entrypoint "./clients/go-tuf/go-tuf" \
--repository-dump-dir $(DUMP_DIR)
@echo Repository dump in $(DUMP_DIR)
Expand Down
5 changes: 5 additions & 0 deletions tuf_conformance/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
import pytest

__version__ = "2.1.0"

# register pytest asserts before the imports happen in conftest.py
pytest.register_assert_rewrite("tuf_conformance.client_runner")
10 changes: 3 additions & 7 deletions tuf_conformance/client_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from tuf.api.exceptions import StorageError
from tuf.api.metadata import Metadata
from tuf.api.serialization.json import JSONSerializer

from tuf_conformance.metadata import MetadataTest
from tuf_conformance.simulator_server import (
Expand Down Expand Up @@ -130,13 +131,8 @@ def assert_metadata(self, role: str, expected_bytes: bytes | None) -> None:
try:
trusted = MetadataTest.from_file(
os.path.join(self.metadata_dir, f"{role}.json")
)
).to_bytes(JSONSerializer())
except StorageError:
trusted = None

if expected_bytes is not None:
expected = Metadata.from_bytes(expected_bytes)
else:
expected = None

assert trusted == expected, f"Unexpected trusted role {role} content"
assert trusted == expected_bytes, f"Unexpected trusted role {role} content"
Loading