|
16 | 16 |
|
17 | 17 | from git.objects import Blob, Tree |
18 | 18 | from git.objects.tree import TreeModifier |
19 | | -from git.repo import Repo |
20 | 19 | from git.util import cwd |
21 | 20 | from test.lib import TestBase, with_rw_directory |
22 | 21 |
|
23 | | -from .lib.helper import PathLikeMock, with_rw_repo |
| 22 | +from .lib.helper import PathLikeMock |
24 | 23 |
|
25 | 24 |
|
26 | 25 | @ddt.ddt |
@@ -303,56 +302,48 @@ def lib_folder(t, _d): |
303 | 302 | # END for each item |
304 | 303 | assert found_slash |
305 | 304 |
|
306 | | - @with_rw_repo("0.3.2.1") |
307 | | - def test_repo_lookup_string_path(self, rw_repo): |
308 | | - repo = Repo(rw_repo.git_dir) |
309 | | - blob = repo.tree() / ".gitignore" |
| 305 | + def test_repo_lookup_string_path(self): |
| 306 | + tree = self.rorepo.tree("0.3.2.1") |
| 307 | + blob = tree / ".gitignore" |
310 | 308 | assert isinstance(blob, Blob) |
311 | 309 | assert blob.hexsha == "787b3d442a113b78e343deb585ab5531eb7187fa" |
312 | 310 |
|
313 | | - @with_rw_repo("0.3.2.1") |
314 | | - def test_repo_lookup_pathlike_path(self, rw_repo): |
315 | | - repo = Repo(rw_repo.git_dir) |
316 | | - blob = repo.tree() / PathLikeMock(".gitignore") |
| 311 | + def test_repo_lookup_pathlike_path(self): |
| 312 | + tree = self.rorepo.tree("0.3.2.1") |
| 313 | + blob = tree / PathLikeMock(".gitignore") |
317 | 314 | assert isinstance(blob, Blob) |
318 | 315 | assert blob.hexsha == "787b3d442a113b78e343deb585ab5531eb7187fa" |
319 | 316 |
|
320 | | - @with_rw_repo("0.3.2.1") |
321 | | - def test_repo_lookup_invalid_string_path(self, rw_repo): |
322 | | - repo = Repo(rw_repo.git_dir) |
| 317 | + def test_repo_lookup_invalid_string_path(self): |
| 318 | + tree = self.rorepo.tree("0.3.2.1") |
323 | 319 | with pytest.raises(KeyError): |
324 | | - repo.tree() / "doesnotexist" |
| 320 | + tree / "doesnotexist" |
325 | 321 |
|
326 | | - @with_rw_repo("0.3.2.1") |
327 | | - def test_repo_lookup_invalid_pathlike_path(self, rw_repo): |
328 | | - repo = Repo(rw_repo.git_dir) |
| 322 | + def test_repo_lookup_invalid_pathlike_path(self): |
| 323 | + tree = self.rorepo.tree("0.3.2.1") |
329 | 324 | with pytest.raises(KeyError): |
330 | | - repo.tree() / PathLikeMock("doesnotexist") |
| 325 | + tree / PathLikeMock("doesnotexist") |
331 | 326 |
|
332 | | - @with_rw_repo("0.3.2.1") |
333 | | - def test_repo_lookup_nested_string_path(self, rw_repo): |
334 | | - repo = Repo(rw_repo.git_dir) |
335 | | - blob = repo.tree() / "git/__init__.py" |
| 327 | + def test_repo_lookup_nested_string_path(self): |
| 328 | + tree = self.rorepo.tree("0.3.2.1") |
| 329 | + blob = tree / "git/__init__.py" |
336 | 330 | assert isinstance(blob, Blob) |
337 | 331 | assert blob.hexsha == "d87dcbdbb65d2782e14eea27e7f833a209c052f3" |
338 | 332 |
|
339 | | - @with_rw_repo("0.3.2.1") |
340 | | - def test_repo_lookup_nested_pathlike_path(self, rw_repo): |
341 | | - repo = Repo(rw_repo.git_dir) |
342 | | - blob = repo.tree() / PathLikeMock("git/__init__.py") |
| 333 | + def test_repo_lookup_nested_pathlike_path(self): |
| 334 | + tree = self.rorepo.tree("0.3.2.1") |
| 335 | + blob = tree / PathLikeMock("git/__init__.py") |
343 | 336 | assert isinstance(blob, Blob) |
344 | 337 | assert blob.hexsha == "d87dcbdbb65d2782e14eea27e7f833a209c052f3" |
345 | 338 |
|
346 | | - @with_rw_repo("0.3.2.1") |
347 | | - def test_repo_lookup_folder_string_path(self, rw_repo): |
348 | | - repo = Repo(rw_repo.git_dir) |
349 | | - tree = repo.tree() / "git" |
| 339 | + def test_repo_lookup_folder_string_path(self): |
| 340 | + tree = self.rorepo.tree("0.3.2.1") |
| 341 | + tree = tree / "git" |
350 | 342 | assert isinstance(tree, Tree) |
351 | 343 | assert tree.hexsha == "ec8ae429156d65afde4bbb3455570193b56f0977" |
352 | 344 |
|
353 | | - @with_rw_repo("0.3.2.1") |
354 | | - def test_repo_lookup_folder_pathlike_path(self, rw_repo): |
355 | | - repo = Repo(rw_repo.git_dir) |
356 | | - tree = repo.tree() / PathLikeMock("git") |
| 345 | + def test_repo_lookup_folder_pathlike_path(self): |
| 346 | + tree = self.rorepo.tree("0.3.2.1") |
| 347 | + tree = tree / PathLikeMock("git") |
357 | 348 | assert isinstance(tree, Tree) |
358 | 349 | assert tree.hexsha == "ec8ae429156d65afde4bbb3455570193b56f0977" |
0 commit comments