mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
Move get_template_path function to pakcage utils
Moved out the function from testing package to project main package.
This commit is contained in:
parent
51e5b74f80
commit
f072bb622f
4 changed files with 8 additions and 7 deletions
|
|
@ -8,7 +8,7 @@ from jinja2 import Template
|
|||
|
||||
from pre_commit_hooks.util import CalledProcessError
|
||||
from pre_commit_hooks.util import cmd_output
|
||||
from testing.util import get_template_path
|
||||
from pre_commit_hooks.util import get_template_path
|
||||
|
||||
|
||||
def get_current_branch() -> str:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from typing import Any
|
||||
|
||||
|
|
@ -30,3 +31,8 @@ def zsplit(s: str) -> list[str]:
|
|||
return s.split('\0')
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
def get_template_path(path: str) -> str:
|
||||
parent_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
|
||||
return os.path.join(parent_dir, 'templates', path)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,3 @@ def get_resource_path(path):
|
|||
def git_commit(*args, **kwargs):
|
||||
cmd = ('git', 'commit', '--no-gpg-sign', '--no-verify', '--no-edit', *args)
|
||||
subprocess.check_call(cmd, **kwargs)
|
||||
|
||||
|
||||
def get_template_path(path):
|
||||
parent_dir = os.path.abspath(os.path.join(TESTING_DIR, os.pardir))
|
||||
return os.path.join(parent_dir, 'templates', path)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from pre_commit_hooks.prepare_commit_msg import get_current_branch
|
|||
from pre_commit_hooks.prepare_commit_msg import main
|
||||
from pre_commit_hooks.prepare_commit_msg import update_commit_file
|
||||
from pre_commit_hooks.util import cmd_output
|
||||
from testing.util import get_template_path
|
||||
from pre_commit_hooks.util import get_template_path
|
||||
|
||||
|
||||
def test_current_branch(temp_git_dir):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue