@@ -131,7 +131,20 @@ def test_init(self):
131131 assert os .path .isdir (r .git_dir )
132132
133133 self ._test_empty_repo (r )
134+
135+ # test clone
136+ clone_path = path + "_clone"
137+ rc = r .clone (clone_path )
138+ self ._test_empty_repo (rc )
139+
134140 shutil .rmtree (git_dir_abs )
141+ try :
142+ shutil .rmtree (clone_path )
143+ except OSError :
144+ # when relative paths are used, the clone may actually be inside
145+ # of the parent directory
146+ pass
147+ # END exception handling
135148 # END for each path
136149
137150 os .makedirs (git_dir_rela )
@@ -151,46 +164,6 @@ def test_init(self):
151164 def test_bare_property (self ):
152165 self .rorepo .bare
153166
154- @patch_object (Repo , '__init__' )
155- @patch_object (Git , '_call_process' )
156- def test_init_with_options (self , git , repo ):
157- git .return_value = True
158- repo .return_value = None
159-
160- r = Repo .init ("repos/foo/bar.git" , ** {'bare' : True ,'template' : "/baz/sweet" })
161- assert isinstance (r , Repo )
162-
163- assert_true (git .called )
164- assert_true (repo .called )
165-
166- @patch_object (Repo , '__init__' )
167- @patch_object (Git , '_call_process' )
168- def test_clone (self , git , repo ):
169- git .return_value = None
170- repo .return_value = None
171-
172- self .rorepo .clone ("repos/foo/bar.git" )
173-
174- assert_true (git .called )
175- path = os .path .join (absolute_project_path (), '.git' )
176- assert_equal (git .call_args , (('clone' , path , 'repos/foo/bar.git' ), {}))
177- assert_true (repo .called )
178-
179- @patch_object (Repo , '__init__' )
180- @patch_object (Git , '_call_process' )
181- def test_clone_with_options (self , git , repo ):
182- git .return_value = None
183- repo .return_value = None
184-
185- self .rorepo .clone ("repos/foo/bar.git" , ** {'template' : '/awesome' })
186-
187- assert_true (git .called )
188- path = os .path .join (absolute_project_path (), '.git' )
189- assert_equal (git .call_args , (('clone' , path , 'repos/foo/bar.git' ),
190- { 'template' : '/awesome' }))
191- assert_true (repo .called )
192-
193-
194167 def test_daemon_export (self ):
195168 orig_val = self .rorepo .daemon_export
196169 self .rorepo .daemon_export = not orig_val
0 commit comments