From f1401803ccf7db5d897a5ef4b27e2176627c430e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 28 Jun 2010 22:25:12 +0200 Subject: Fixed performance tests which broke in the course of the sha1-20 byte changes --- test/git/performance/test_commit.py | 3 ++- test/git/performance/test_streams.py | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'test/git/performance') diff --git a/test/git/performance/test_commit.py b/test/git/performance/test_commit.py index 0571d0d9..a951f242 100644 --- a/test/git/performance/test_commit.py +++ b/test/git/performance/test_commit.py @@ -6,6 +6,7 @@ from lib import * from git import * +from gitdb import IStream from test.git.test_commit import assert_commit_serialization from cStringIO import StringIO from time import time @@ -91,7 +92,7 @@ class TestPerformance(TestBigRepoRW): slen = stream.tell() stream.seek(0) - cm.sha = make_object(IStream(Commit.type, slen, stream)).sha + cm.binsha = make_object(IStream(Commit.type, slen, stream)).binsha # END commit creation elapsed = time() - st diff --git a/test/git/performance/test_streams.py b/test/git/performance/test_streams.py index 36d0d29c..ec061ece 100644 --- a/test/git/performance/test_streams.py +++ b/test/git/performance/test_streams.py @@ -2,6 +2,7 @@ from test.testlib import * from gitdb import * +from gitdb.util import bin_to_hex from time import time import os @@ -37,10 +38,10 @@ class TestObjDBPerformance(TestBigRepoR): # writing - due to the compression it will seem faster than it is st = time() - sha = ldb.store(IStream('blob', size, stream)).sha + binsha = ldb.store(IStream('blob', size, stream)).binsha elapsed_add = time() - st - assert ldb.has_object(sha) - db_file = ldb.readable_db_object_path(sha) + assert ldb.has_object(binsha) + db_file = ldb.readable_db_object_path(bin_to_hex(binsha)) fsize_kib = os.path.getsize(db_file) / 1000 @@ -49,7 +50,7 @@ class TestObjDBPerformance(TestBigRepoR): # reading all at once st = time() - ostream = ldb.stream(sha) + ostream = ldb.stream(binsha) shadata = ostream.read() elapsed_readall = time() - st @@ -62,7 +63,7 @@ class TestObjDBPerformance(TestBigRepoR): cs = 512*1000 chunks = list() st = time() - ostream = ldb.stream(sha) + ostream = ldb.stream(binsha) while True: data = ostream.read(cs) chunks.append(data) @@ -94,7 +95,7 @@ class TestObjDBPerformance(TestBigRepoR): proc.wait() gelapsed_add = time() - st del(data) - assert gitsha == sha # we do it the same way, right ? + assert gitsha == bin_to_hex(binsha) # we do it the same way, right ? # as its the same sha, we reuse our path fsize_kib = os.path.getsize(db_file) / 1000 -- cgit v1.2.3