mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Make a helper for running pre-commit as a subprocess under test
This commit is contained in:
parent
e2451109f7
commit
57638134e3
4 changed files with 33 additions and 42 deletions
|
|
@ -49,6 +49,15 @@ def is_valid_according_to_schema(obj, schema):
|
|||
return False
|
||||
|
||||
|
||||
def cmd_output_mocked_pre_commit_home(*args, **kwargs):
|
||||
# keyword-only argument
|
||||
tempdir_factory = kwargs.pop('tempdir_factory')
|
||||
pre_commit_home = kwargs.pop('pre_commit_home', tempdir_factory.get())
|
||||
# Don't want to write to the home directory
|
||||
env = dict(kwargs.pop('env', os.environ), PRE_COMMIT_HOME=pre_commit_home)
|
||||
return cmd_output(*args, env=env, **kwargs)
|
||||
|
||||
|
||||
skipif_slowtests_false = pytest.mark.skipif(
|
||||
os.environ.get('slowtests') == 'false',
|
||||
reason='slowtests=false',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue