← Back to team overview

dulwich-users team mailing list archive

[PATCH 26/34] test_walk: Simplify commit_time attr assignment.

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

Change-Id: I5818da44121a89eec590e52b8b0053d839e4713a
---
 dulwich/tests/test_walk.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dulwich/tests/test_walk.py b/dulwich/tests/test_walk.py
index 0fabd4a..ead7bd1 100644
--- a/dulwich/tests/test_walk.py
+++ b/dulwich/tests/test_walk.py
@@ -72,7 +72,12 @@ class WalkerTest(TestCase):
         self.store = MemoryObjectStore()
 
     def make_commits(self, commit_spec, **kwargs):
-        return build_commit_graph(self.store, commit_spec, **kwargs)
+        times = kwargs.pop('times', [])
+        attrs = kwargs.pop('attrs', {})
+        for i, t in enumerate(times):
+            attrs.setdefault(i + 1, {})['commit_time'] = t
+        return build_commit_graph(self.store, commit_spec, attrs=attrs,
+                                  **kwargs)
 
     def make_linear_commits(self, num_commits, **kwargs):
         commit_spec = []
@@ -330,9 +335,8 @@ class WalkerTest(TestCase):
         self.assertWalkYields([c2], [c3.id], since=50, until=150)
 
     def test_since_over_scan(self):
-        times = [9, 0, 1, 2, 3, 4, 5, 8, 6, 7, 9]
-        attrs = dict((i + 1, {'commit_time': t}) for i, t in enumerate(times))
-        commits = self.make_linear_commits(11, attrs=attrs)
+        commits = self.make_linear_commits(
+          11, times=[9, 0, 1, 2, 3, 4, 5, 8, 6, 7, 9])
         c8, _, c10, c11 = commits[-4:]
         del self.store[commits[0].id]
         # c9 is older than we want to walk, but is out of order with its parent,
-- 
1.7.3.1



References