mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Move cwd() to tests-only
This commit is contained in:
parent
082c950d8f
commit
29033f10ca
21 changed files with 84 additions and 103 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import contextlib
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
|
|
@ -103,3 +104,13 @@ def run_opts(
|
|||
show_diff_on_failure=show_diff_on_failure,
|
||||
commit_msg_filename=commit_msg_filename,
|
||||
)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def cwd(path):
|
||||
original_cwd = os.getcwd()
|
||||
os.chdir(path)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
os.chdir(original_cwd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue