11from __future__ import absolute_import
22
3+ import subprocess
4+
35import pytest
4- from pre_commit .util import cmd_output
56
67from pre_commit_hooks .forbid_new_submodules import main
78
89
910@pytest .fixture
1011def 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)
3334def 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
4041def 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