Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d77d01c

Browse files
committed
Rename RepoInstaller to Repository
1 parent abea886 commit d77d01c

3 files changed

Lines changed: 43 additions & 63 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pre_commit.hooks_workspace import in_hooks_workspace
66

77

8-
class RepoInstaller(object):
8+
class Repository(object):
99
def __init__(self, repo_config):
1010
self.repo_config = repo_config
1111

tests/repo_installer_test.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

tests/repository_test.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os
2+
3+
import pytest
4+
from pre_commit import git
5+
6+
import pre_commit.constants as C
7+
from pre_commit.repository import Repository
8+
9+
10+
@pytest.fixture
11+
def dummy_repo_config(dummy_git_repo):
12+
# This is not a valid config, but it is pretty close
13+
return {
14+
'repo': dummy_git_repo,
15+
'sha': git.get_head_sha(dummy_git_repo),
16+
'hooks': [],
17+
}
18+
19+
20+
@pytest.mark.integration
21+
def test_create_repo_in_env(dummy_repo_config, dummy_git_repo):
22+
repo = Repository(dummy_repo_config)
23+
repo.create()
24+
25+
assert os.path.exists(
26+
os.path.join(dummy_git_repo, C.HOOKS_WORKSPACE, repo.sha),
27+
)
28+
29+
@pytest.mark.integration
30+
def test_install_python_repo_in_env(python_pre_commit_git_repo, config_for_python_pre_commit_git_repo):
31+
repo = Repository(config_for_python_pre_commit_git_repo)
32+
# TODO: do we need create here?
33+
repo.install()
34+
35+
assert os.path.exists(
36+
os.path.join(
37+
python_pre_commit_git_repo,
38+
C.HOOKS_WORKSPACE,
39+
repo.sha,
40+
'py_env',
41+
),
42+
)

0 commit comments

Comments
 (0)