Skip to content

Commit cecd169

Browse files
committed
improving test
1 parent e3ea69b commit cecd169

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

gitevo/application.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _ensure_git_repos(self, repo: str) -> list[str]:
219219
raise BadGitRepo(f'{repo} is not a directory')
220220

221221
# Check if repo is a git dir
222-
if self._is_git_dir(repo):
222+
if is_git_dir(repo):
223223
# print('Local Git repository:', repo)
224224
return [repo]
225225

@@ -230,7 +230,7 @@ def _ensure_git_repos(self, repo: str) -> list[str]:
230230
git_repos = []
231231
print('Directory containing multiple Git repositories')
232232
for path in paths:
233-
if self._is_git_dir(path):
233+
if is_git_dir(path):
234234
print('- Found Git repository:', path)
235235
git_repos.append(path)
236236
else:
@@ -247,10 +247,6 @@ def _check_registered_metrics(self, metric_info: MetricInfo):
247247
if metric_info.version_chart_type not in ['donut', 'pie', 'bar', 'hbar']:
248248
raise BadVersionChart(f'version chart in {metric_info.name} should be donut, pie, bar, or hbar, not {metric_info.version_chart_type}')
249249

250-
def _is_git_dir(self, project_path):
251-
git_path = os.path.join(project_path, '.git')
252-
return is_git_dir(git_path)
253-
254250
def _is_git_remote(self, repo: str) -> bool:
255251
return repo.startswith(("git@", "https://", "http://", "git://"))
256252

gitevo/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
from datetime import date
77
from gitevo.exceptions import BadGitRepo
88

9+
def is_git_dir(project_path):
10+
git_path = os.path.join(project_path, '.git')
11+
return _is_git_dir(git_path)
912

10-
def is_git_dir(d: str) -> bool:
13+
14+
def _is_git_dir(d: str) -> bool:
1115
# From GitPython
1216
if osp.isdir(d):
1317
if (osp.isdir(osp.join(d, "objects")) or "GIT_OBJECT_DIRECTORY" in os.environ) and osp.isdir(

tests/test_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def test_formatted_dates_month():
5555
'01/2001', '02/2001', '03/2001', '04/2001']
5656

5757
def test_is_git_dir(local_repo):
58-
git_repo = os.path.join(local_repo, '.git')
59-
assert is_git_dir(git_repo)
58+
assert is_git_dir(local_repo)
6059

6160
def test_is_notgit_dir():
6261
assert not is_git_dir('gitevo')

0 commit comments

Comments
 (0)