Skip to content

Commit 79b9dbd

Browse files
committed
Fixed performance commit object testing
1 parent 47f14d5 commit 79b9dbd

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

git/test/objects/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

git/test/performance/lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def setUpAll(cls):
6565
super(TestBigRepoRW, cls).setUpAll()
6666
dirname = tempfile.mktemp()
6767
os.mkdir(dirname)
68-
cls.rwrepo = cls.gitrorepo.clone(dirname, shared=True, bare=True)
68+
cls.rwrepo = cls.rorepo.clone(dirname, shared=True, bare=True)
6969

7070
@classmethod
7171
def tearDownAll(cls):

git/test/performance/test_commit.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
from lib import *
88
from git import *
9-
from git import IStream
10-
from git.test.test_commit import assert_commit_serialization
9+
from git.base import IStream
10+
from git.test.objects.test_commit import assert_commit_serialization
1111
from cStringIO import StringIO
1212
from time import time
1313
import sys
1414

1515
class TestPerformance(TestBigRepoRW):
16-
16+
1717
# ref with about 100 commits in its history
18-
ref_100 = '0.1.6'
18+
ref_100 = 'v0.99'
1919

2020
def _query_commit_info(self, c):
2121
c.author
@@ -45,13 +45,14 @@ def test_iteration(self):
4545
# END for each object
4646
# END for each commit
4747
elapsed_time = time() - st
48+
assert no, "Should have traversed a few objects"
4849
print >> sys.stderr, "Traversed %i Trees and a total of %i unchached objects in %s [s] ( %f objs/s )" % (nc, no, elapsed_time, no/elapsed_time)
4950

5051
def test_commit_traversal(self):
5152
# bound to cat-file parsing performance
5253
nc = 0
5354
st = time()
54-
for c in self.gitrorepo.commit(self.head_sha_2k).traverse(branch_first=False):
55+
for c in self.rorepo.commit(self.head_sha_2k).traverse(branch_first=False):
5556
nc += 1
5657
self._query_commit_info(c)
5758
# END for each traversed commit
@@ -62,7 +63,7 @@ def test_commit_iteration(self):
6263
# bound to stream parsing performance
6364
nc = 0
6465
st = time()
65-
for c in Commit.iter_items(self.gitrorepo, self.head_sha_2k):
66+
for c in Commit.iter_items(self.rorepo, self.head_sha_2k):
6667
nc += 1
6768
self._query_commit_info(c)
6869
# END for each traversed commit
@@ -73,7 +74,7 @@ def test_commit_serialization(self):
7374
assert_commit_serialization(self.rwrepo, self.head_sha_2k, True)
7475

7576
rwrepo = self.rwrepo
76-
make_object = rwrepo.odb.store
77+
make_object = rwrepo.store
7778
# direct serialization - deserialization can be tested afterwards
7879
# serialization is probably limited on IO
7980
hc = rwrepo.commit(self.head_sha_2k)

0 commit comments

Comments
 (0)