22#
33# This module is part of GitDB and is released under
44# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
5- from lib import *
5+ from git .test .lib import rorepo_dir
6+ from git .test .db .lib import *
67from git .exc import BadObject
7- from git .db .py import PureGitODB
8+ from git .db .py . complex import PureGitODB
89from git .base import OStream , OInfo
910from git .util import hex_to_bin , bin_to_hex
10-
11+
12+ import os
13+
1114class TestGitDB (TestDBBase ):
15+ RepoCls = PureGitODB
1216
1317 def test_reading (self ):
14- gdb = PureGitODB ( fixture_path ( '../../../.git/ objects' ))
18+ gdb = self . RepoCls ( os . path . join ( rorepo_dir (), ' objects' ))
1519
1620 # we have packs and loose objects, alternates doesn't necessarily exist
1721 assert 1 < len (gdb .databases ()) < 4
1822
1923 # access should be possible
20- git_sha = hex_to_bin ("5690fd0d3304f378754b23b098bd7cb5f4aa1976 " )
24+ git_sha = hex_to_bin ("5aebcd5cb3340fb31776941d7e4d518a712a8655 " )
2125 assert isinstance (gdb .info (git_sha ), OInfo )
2226 assert isinstance (gdb .stream (git_sha ), OStream )
2327 assert gdb .size () > 200
@@ -29,18 +33,18 @@ def test_reading(self):
2933 # have a separate test module
3034 # test partial shas
3135 # this one as uneven and quite short
32- assert gdb .partial_to_complete_sha_hex ('155b6 ' ) == hex_to_bin ("155b62a9af0aa7677078331e111d0f7aa6eb4afc " )
36+ assert gdb .partial_to_complete_sha_hex ('5aebcd ' ) == hex_to_bin ("5aebcd5cb3340fb31776941d7e4d518a712a8655 " )
3337
3438 # mix even/uneven hexshas
35- for i , binsha in enumerate (sha_list ):
39+ for i , binsha in enumerate (sha_list [: 50 ] ):
3640 assert gdb .partial_to_complete_sha_hex (bin_to_hex (binsha )[:8 - (i % 2 )]) == binsha
3741 # END for each sha
3842
3943 self .failUnlessRaises (BadObject , gdb .partial_to_complete_sha_hex , "0000" )
4044
4145 @with_rw_directory
4246 def test_writing (self , path ):
43- gdb = PureGitODB (path )
47+ gdb = self . RepoCls (path )
4448
4549 # its possible to write objects
4650 self ._assert_object_writing (gdb )
0 commit comments