Skip to content

Commit a19073a

Browse files
committed
Review comments
1 parent 33dd8bf commit a19073a

File tree

3 files changed

+29
-32
lines changed

3 files changed

+29
-32
lines changed

tests/vcs/git/git_fixture.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import shutil
43
import typing
54

65

@@ -10,9 +9,6 @@
109
import dulwich.repo
1110

1211

13-
GIT_NOT_INSTALLLED = shutil.which("git") is None
14-
15-
1612
class TempRepoFixture(typing.NamedTuple):
1713
path: Path
1814
repo: dulwich.repo.Repo

tests/vcs/git/test_backend.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,26 @@ def test_urlpathjoin(url: str, expected_result: str) -> None:
8484
assert result == expected_result
8585

8686

87-
class TestBackendGit:
88-
@pytest.mark.skip_git_mock
89-
def test_clone_success(self, tmp_path: Path, temp_repo: TempRepoFixture) -> None:
90-
source_root_dir = tmp_path / "test-repo"
91-
Git.clone(
92-
url=temp_repo.path.as_uri(), source_root=source_root_dir, name="clone-test"
93-
)
94-
95-
target_dir = source_root_dir / "clone-test"
96-
assert (target_dir / ".git").is_dir()
97-
98-
@pytest.mark.skip_git_mock
99-
def test_short_sha_not_in_head(
100-
self, tmp_path: Path, temp_repo: TempRepoFixture
101-
) -> None:
102-
source_root_dir = tmp_path / "test-repo"
103-
Git.clone(
104-
url=temp_repo.path.as_uri(),
105-
revision=temp_repo.middle_commit[:6],
106-
name="clone-test",
107-
source_root=source_root_dir,
108-
)
109-
110-
target_dir = source_root_dir / "clone-test"
111-
assert (target_dir / ".git").is_dir()
87+
@pytest.mark.skip_git_mock
88+
def test_clone_success(tmp_path: Path, temp_repo: TempRepoFixture) -> None:
89+
source_root_dir = tmp_path / "test-repo"
90+
Git.clone(
91+
url=temp_repo.path.as_uri(), source_root=source_root_dir, name="clone-test"
92+
)
93+
94+
target_dir = source_root_dir / "clone-test"
95+
assert (target_dir / ".git").is_dir()
96+
97+
98+
@pytest.mark.skip_git_mock
99+
def test_short_sha_not_in_head(tmp_path: Path, temp_repo: TempRepoFixture) -> None:
100+
source_root_dir = tmp_path / "test-repo"
101+
Git.clone(
102+
url=temp_repo.path.as_uri(),
103+
revision=temp_repo.middle_commit[:6],
104+
name="clone-test",
105+
source_root=source_root_dir,
106+
)
107+
108+
target_dir = source_root_dir / "clone-test"
109+
assert (target_dir / ".git").is_dir()

tests/vcs/git/test_system.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
from __future__ import annotations
22

33
import re
4+
import shutil
45
import subprocess
56
import typing
67

78
import pytest
89

910
from poetry.vcs.git.system import SystemGit
10-
from tests.vcs.git.git_fixture import GIT_NOT_INSTALLLED
11-
from tests.vcs.git.git_fixture import TempRepoFixture
1211

1312

1413
if typing.TYPE_CHECKING:
1514
from pathlib import Path
1615

16+
from tests.vcs.git.git_fixture import TempRepoFixture
17+
18+
GIT_NOT_INSTALLED = shutil.which("git") is None
19+
1720

1821
def get_head_sha(cwd: Path) -> str:
1922
return subprocess.check_output(
@@ -24,7 +27,7 @@ def get_head_sha(cwd: Path) -> str:
2427
).strip()
2528

2629

27-
@pytest.mark.skipif(GIT_NOT_INSTALLLED, reason="These tests requires git cli")
30+
@pytest.mark.skipif(GIT_NOT_INSTALLED, reason="These tests requires git cli")
2831
class TestSystemGit:
2932
def test_clone_success(self, tmp_path: Path, temp_repo: TempRepoFixture) -> None:
3033
target_dir = tmp_path / "test-repo"

0 commit comments

Comments
 (0)