Skip to content

Commit 155158e

Browse files
committed
Added PackedDB test with generalized type to allows other implementations to be tested as well at some point
1 parent d103257 commit 155158e

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

git/test/performance/db/odb_impl.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from time import time
44
import sys
55
import stat
6-
import copy
76

87
from git.test.performance.lib import (
98
TestBigRepoR,

git/test/performance/test_pack.py renamed to git/test/performance/db/packedodb_impl.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,35 @@
33
# This module is part of GitDB and is released under
44
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
55
"""Performance tests for object store"""
6-
from lib import (
7-
TestBigRepoR
6+
from git.test.performance.lib import (
7+
TestBigRepoR,
8+
GlobalsItemDeletorMetaCls
89
)
910

1011
from git.exc import UnsupportedOperation
11-
from git.db.py.pack import PurePackedODB
1212

1313
import sys
1414
import os
1515
from time import time
1616
import random
1717

18-
class TestPurePackedODBPerformance(TestBigRepoR):
18+
19+
class PerfBaseDeletorMetaClass(GlobalsItemDeletorMetaCls):
20+
ModuleToDelete = 'TestPurePackedODBPerformanceBase'
21+
22+
class TestPurePackedODBPerformanceBase(TestBigRepoR):
23+
__metaclass__ = PerfBaseDeletorMetaClass
1924

2025
#{ Configuration
21-
PackedODBCls = PurePackedODB
26+
PackedODBCls = None
2227
#} END configuration
2328

2429
@classmethod
2530
def setUpAll(cls):
26-
super(TestPurePackedODBPerformance, cls).setUpAll()
31+
super(TestPurePackedODBPerformanceBase, cls).setUpAll()
32+
if cls.PackedODBCls is None:
33+
raise AssertionError("PackedODBCls must be set in subclass")
34+
#END assert configuration
2735
cls.ropdb = cls.PackedODBCls(cls.rorepo.db_path("pack"))
2836

2937
def test_pack_random_access(self):
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from packedodb_impl import TestPurePackedODBPerformanceBase
2+
from git.db.py.pack import PurePackedODB
3+
4+
class TestPurePackedODB(TestPurePackedODBPerformanceBase):
5+
#{ Configuration
6+
PackedODBCls = PurePackedODB
7+
#} END configuration

0 commit comments

Comments
 (0)