1010from pre_commit_terraform .terraform_docs_replace import (
1111 invoke_cli_app ,
1212 populate_argument_parser ,
13+ )
14+ from pre_commit_terraform .terraform_docs_replace import (
1315 subprocess as replace_docs_subprocess_mod ,
1416)
1517
@@ -24,8 +26,7 @@ def test_arg_parser_populated() -> None:
2426def test_check_is_deprecated () -> None :
2527 """Verify that `replace-docs` shows a deprecation warning."""
2628 deprecation_msg_regex = (
27- r'^`terraform_docs_replace` hook is DEPRECATED\.'
28- 'For migration.*$'
29+ r'^`terraform_docs_replace` hook is DEPRECATED\.' 'For migration.*$'
2930 )
3031 with pytest .warns (UserWarning , match = deprecation_msg_regex ):
3132 # not `pytest.deprecated_call()` due to this being a user warning
@@ -70,10 +71,10 @@ def test_check_is_deprecated() -> None:
7071 'pre_commit_terraform.terraform_docs_replace' ,
7172)
7273def test_control_flow_positive (
73- expected_cmds : list [str ],
74- mocker : pytest_mock .MockerFixture ,
75- monkeypatch : pytest .MonkeyPatch ,
76- parsed_cli_args : Namespace ,
74+ expected_cmds : list [str ],
75+ mocker : pytest_mock .MockerFixture ,
76+ monkeypatch : pytest .MonkeyPatch ,
77+ parsed_cli_args : Namespace ,
7778) -> None :
7879 """Check that the subcommand's happy path works."""
7980 check_call_mock = mocker .Mock ()
@@ -83,10 +84,10 @@ def test_control_flow_positive(
8384 check_call_mock ,
8485 )
8586
86- assert ReturnCode . OK == invoke_cli_app (parsed_cli_args )
87+ assert invoke_cli_app (parsed_cli_args ) == ReturnCode . OK
8788
8889 executed_commands = [
89- cmd for ((cmd , ), _shell ) in check_call_mock .call_args_list
90+ cmd for ((cmd ,), _shell ) in check_call_mock .call_args_list
9091 ]
9192
9293 assert len (expected_cmds ) == check_call_mock .call_count
@@ -98,8 +99,8 @@ def test_control_flow_positive(
9899 'pre_commit_terraform.terraform_docs_replace' ,
99100)
100101def test_control_flow_negative (
101- mocker : pytest_mock .MockerFixture ,
102- monkeypatch : pytest .MonkeyPatch ,
102+ mocker : pytest_mock .MockerFixture ,
103+ monkeypatch : pytest .MonkeyPatch ,
103104) -> None :
104105 """Check that the subcommand's error processing works."""
105106 parsed_cli_args = Namespace (
@@ -118,6 +119,6 @@ def test_control_flow_negative(
118119 check_call_mock ,
119120 )
120121
121- assert ReturnCode . ERROR == invoke_cli_app (parsed_cli_args )
122+ assert invoke_cli_app (parsed_cli_args ) == ReturnCode . ERROR
122123
123124 check_call_mock .assert_called_once_with (expected_cmd , shell = True )
0 commit comments