dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00347
[PATCH 22/24] Use ext_functest_builder for existing extension tests.
From: Dave Borowitz <dborowitz@xxxxxxxxxx>
Change-Id: I3f2c9ebba49587999f14483affeff7c67dc74696
---
dulwich/tests/test_diff_tree.py | 23 ++++++++---------------
dulwich/tests/test_objects.py | 35 +++++++++++++----------------------
2 files changed, 21 insertions(+), 37 deletions(-)
diff --git a/dulwich/tests/test_diff_tree.py b/dulwich/tests/test_diff_tree.py
index 77cf7aa..4a26e1f 100644
--- a/dulwich/tests/test_diff_tree.py
+++ b/dulwich/tests/test_diff_tree.py
@@ -51,10 +51,11 @@ from dulwich.objects import (
)
from dulwich.tests import (
TestCase,
- TestSkipped,
)
from dulwich.tests.utils import (
make_object,
+ functest_builder,
+ ext_functest_builder,
)
# Shorthand mode for Files.
@@ -133,13 +134,10 @@ class TreeChangesTest(DiffTestCase):
self.assertMergeFails(merge_entries, 'a', 'deadbeef', '1' * 40)
self.assertMergeFails(merge_entries, 'a', 0100644, 0xdeadbeef)
- def test_merge_entries(self):
- self._do_test_merge_entries(_merge_entries_py)
-
- def test_merge_entries_extension(self):
- if _merge_entries is _merge_entries_py:
- raise TestSkipped('merge_entries extension not found')
- self._do_test_merge_entries(_merge_entries)
+ test_merge_entries = functest_builder(_do_test_merge_entries,
+ _merge_entries_py)
+ test_merge_entries_extension = ext_functest_builder(_do_test_merge_entries,
+ _merge_entries)
def _do_test_is_tree(self, is_tree):
self.assertFalse(is_tree(TreeEntry(None, None, None)))
@@ -150,13 +148,8 @@ class TreeChangesTest(DiffTestCase):
self.assertRaises(TypeError, is_tree, TreeEntry('a', 'x', 'a' * 40))
self.assertRaises(AttributeError, is_tree, 1234)
- def test_is_tree(self):
- self._do_test_is_tree(_is_tree_py)
-
- def test_is_tree_extension(self):
- if _is_tree is _is_tree_py:
- raise TestSkipped('is_tree extension not found')
- self._do_test_is_tree(_is_tree)
+ test_is_tree = functest_builder(_do_test_is_tree, _is_tree_py)
+ test_is_tree_extension = ext_functest_builder(_do_test_is_tree, _is_tree)
def assertChangesEqual(self, expected, tree1, tree2, **kwargs):
actual = list(tree_changes(self.store, tree1.id, tree2.id, **kwargs))
diff --git a/dulwich/tests/test_objects.py b/dulwich/tests/test_objects.py
index 3d46503..d5e2859 100644
--- a/dulwich/tests/test_objects.py
+++ b/dulwich/tests/test_objects.py
@@ -54,11 +54,12 @@ from dulwich.objects import (
)
from dulwich.tests import (
TestCase,
- TestSkipped,
)
from utils import (
make_commit,
make_object,
+ functest_builder,
+ ext_functest_builder,
)
a_sha = '6f670c0fb53f9463760b7295fbb814e965fb20c8'
@@ -446,13 +447,9 @@ class TreeTests(ShaFileCheckTests):
self.assertRaises(ObjectFormatException,
eval_parse_tree, broken_tree, strict=True)
- def test_parse_tree(self):
- self._do_test_parse_tree(_parse_tree_py)
-
- def test_parse_tree_extension(self):
- if parse_tree is _parse_tree_py:
- raise TestSkipped('parse_tree extension not found')
- self._do_test_parse_tree(parse_tree)
+ test_parse_tree = functest_builder(_do_test_parse_tree, _parse_tree_py)
+ test_parse_tree_extension = ext_functest_builder(_do_test_parse_tree,
+ parse_tree)
def _do_test_sorted_tree_items(self, sorted_tree_items):
def do_sort(entries):
@@ -474,13 +471,10 @@ class TreeTests(ShaFileCheckTests):
self.assertRaises(errors, do_sort, {'foo': ('xxx', myhexsha)})
self.assertRaises(errors, do_sort, {'foo': (0100755, 12345)})
- def test_sorted_tree_items(self):
- self._do_test_sorted_tree_items(_sorted_tree_items_py)
-
- def test_sorted_tree_items_extension(self):
- if sorted_tree_items is _sorted_tree_items_py:
- raise TestSkipped('sorted_tree_items extension not found')
- self._do_test_sorted_tree_items(sorted_tree_items)
+ test_sorted_tree_items = functest_builder(_do_test_sorted_tree_items,
+ _sorted_tree_items_py)
+ test_sorted_tree_items_extension = ext_functest_builder(
+ _do_test_sorted_tree_items, sorted_tree_items)
def _do_test_sorted_tree_items_name_order(self, sorted_tree_items):
self.assertEqual([
@@ -491,13 +485,10 @@ class TreeTests(ShaFileCheckTests):
'd80c186a03f423a81b39df39dc87fd269736ca86'),
], list(sorted_tree_items(_TREE_ITEMS, True)))
- def test_sorted_tree_items_name_order(self):
- self._do_test_sorted_tree_items_name_order(_sorted_tree_items_py)
-
- def test_sorted_tree_items_name_order_extension(self):
- if sorted_tree_items is _sorted_tree_items_py:
- raise TestSkipped('sorted_tree_items extension not found')
- self._do_test_sorted_tree_items_name_order(sorted_tree_items)
+ test_sorted_tree_items_name_order = functest_builder(
+ _do_test_sorted_tree_items_name_order, _sorted_tree_items_py)
+ test_sorted_tree_items_name_order_extension = ext_functest_builder(
+ _do_test_sorted_tree_items_name_order, sorted_tree_items)
def test_check(self):
t = Tree
--
1.7.3.2.168.gd6b63
References