Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Nov 20, 2024
1 parent 5bd188b commit 3878e14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
21 changes: 6 additions & 15 deletions dulwich/tests/test_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

"""Tests for the object store interface."""

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any, Callable
from unittest import skipUnless

from dulwich.index import commit_tree
Expand Down Expand Up @@ -53,20 +53,11 @@
class ObjectStoreTests:
store: "BaseObjectStore"

def assertEqual(self, a, b) -> None:
raise NotImplementedError

def assertRaises(self, exc, func) -> None:
raise NotImplementedError

def assertNotIn(self, a, b) -> None:
raise NotImplementedError

def assertNotEqual(self, a, b) -> None:
raise NotImplementedError

def assertIn(self, a, b) -> None:
raise NotImplementedError
assertEqual: Callable[[object, object], None]
assertRaises: Callable[[type[Exception], Callable[[], Any]], None]
assertNotIn: Callable[[object, object], None]
assertNotEqual: Callable[[object, object], None]
assertIn: Callable[[object, object], None]

def test_determine_wants_all(self) -> None:
self.assertEqual(
Expand Down
9 changes: 5 additions & 4 deletions tests/test_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,8 +1295,6 @@ def test_bad_ext_ref_thin_pack(self) -> None:
self.assertEqual((sorted([b2.id, b3.id]),), (sorted(e.shas),))

def test_ext_ref_deltified_object_based_on_itself(self) -> None:
td = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, td)
b1_content = b"foo"
(b1,) = self.store_blobs([b1_content])
f = BytesIO()
Expand All @@ -1311,12 +1309,15 @@ def test_ext_ref_deltified_object_based_on_itself(self) -> None:
fsize = f.tell()
f.seek(0)
packdata = PackData.from_file(f, fsize)
td = tempfile.mkdtemp()
idx_path = os.path.join(td, "test.idx")
self.addCleanup(shutil.rmtree, td)
packdata.create_index(
td.join("test.idx"),
idx_path,
version=2,
resolve_ext_ref=self.get_raw_no_repeat,
)
packindex = load_pack_index(td.join("test.idx"))
packindex = load_pack_index(idx_path)
pack = Pack.from_objects(packdata, packindex)
try:
# Attempting to open this REF_DELTA object would loop forever
Expand Down

0 comments on commit 3878e14

Please sign in to comment.