Skip to content

Commit dbf7de0

Browse files
authored
Merge pull request #325 from pre-commit/use_subprocess
Use subprocess directly
2 parents 08e2918 + 69f2da6 commit dbf7de0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
from __future__ import absolute_import
22

3+
import subprocess
4+
35
import pytest
4-
from pre_commit.util import cmd_output
56

67
from pre_commit_hooks.forbid_new_submodules import main
78

89

910
@pytest.fixture
1011
def git_dir_with_git_dir(tmpdir):
1112
with tmpdir.as_cwd():
12-
cmd_output('git', 'init', '.')
13-
cmd_output(
14-
'git', 'commit', '-m', 'init', '--allow-empty', '--no-gpg-sign',
15-
)
16-
cmd_output('git', 'init', 'foo')
17-
cmd_output(
13+
subprocess.check_call(('git', 'init', '.'))
14+
subprocess.check_call((
1815
'git', 'commit', '-m', 'init', '--allow-empty', '--no-gpg-sign',
16+
))
17+
subprocess.check_call(('git', 'init', 'foo'))
18+
subprocess.check_call(
19+
('git', 'commit', '-m', 'init', '--allow-empty', '--no-gpg-sign'),
1920
cwd=tmpdir.join('foo').strpath,
2021
)
2122
yield
@@ -31,13 +32,13 @@ def git_dir_with_git_dir(tmpdir):
3132
),
3233
)
3334
def test_main_new_submodule(git_dir_with_git_dir, capsys, cmd):
34-
cmd_output(*cmd)
35+
subprocess.check_call(cmd)
3536
assert main() == 1
3637
out, _ = capsys.readouterr()
3738
assert out.startswith('foo: new submodule introduced\n')
3839

3940

4041
def test_main_no_new_submodule(git_dir_with_git_dir):
4142
open('test.py', 'a+').close()
42-
cmd_output('git', 'add', 'test.py')
43+
subprocess.check_call(('git', 'add', 'test.py'))
4344
assert main() == 0

0 commit comments

Comments
 (0)