66from pathlib import Path
77
88import pytest
9-
109from python_security_auditing .report import build_markdown , check_thresholds , write_step_summary
1110from python_security_auditing .settings import Settings
1211
@@ -57,7 +56,9 @@ def test_bandit_high_blocks(bandit_issues: dict, pip_clean: list) -> None: # ty
5756 assert check_thresholds (bandit_issues , pip_clean , s ) is True
5857
5958
60- def test_bandit_medium_does_not_block_at_high_threshold (bandit_issues : dict , pip_clean : list ) -> None : # type: ignore[type-arg]
59+ def test_bandit_medium_does_not_block_at_high_threshold (
60+ bandit_issues : dict , pip_clean : list
61+ ) -> None : # type: ignore[type-arg]
6162 """bandit_issues has HIGH and MEDIUM; only HIGH should block when threshold=HIGH."""
6263 s = Settings ()
6364 # Remove HIGH results so only MEDIUM remain
@@ -68,7 +69,9 @@ def test_bandit_medium_does_not_block_at_high_threshold(bandit_issues: dict, pip
6869 assert check_thresholds (medium_only , pip_clean , s ) is False
6970
7071
71- def test_bandit_medium_blocks_at_medium_threshold (bandit_issues : dict , pip_clean : list , monkeypatch : pytest .MonkeyPatch ) -> None : # type: ignore[type-arg]
72+ def test_bandit_medium_blocks_at_medium_threshold (
73+ bandit_issues : dict , pip_clean : list , monkeypatch : pytest .MonkeyPatch
74+ ) -> None : # type: ignore[type-arg]
7275 monkeypatch .setenv ("BANDIT_SEVERITY_THRESHOLD" , "MEDIUM" )
7376 s = Settings ()
7477 medium_only = {
@@ -88,19 +91,25 @@ def test_pip_unfixable_does_not_block_on_fixable(bandit_clean: dict, pip_unfixab
8891 assert check_thresholds (bandit_clean , pip_unfixable , s ) is False
8992
9093
91- def test_pip_unfixable_blocks_on_all (bandit_clean : dict , pip_unfixable : list , monkeypatch : pytest .MonkeyPatch ) -> None : # type: ignore[type-arg]
94+ def test_pip_unfixable_blocks_on_all (
95+ bandit_clean : dict , pip_unfixable : list , monkeypatch : pytest .MonkeyPatch
96+ ) -> None : # type: ignore[type-arg]
9297 monkeypatch .setenv ("PIP_AUDIT_BLOCK_ON" , "all" )
9398 s = Settings ()
9499 assert check_thresholds (bandit_clean , pip_unfixable , s ) is True
95100
96101
97- def test_pip_fixable_does_not_block_on_none (bandit_clean : dict , pip_fixable : list , monkeypatch : pytest .MonkeyPatch ) -> None : # type: ignore[type-arg]
102+ def test_pip_fixable_does_not_block_on_none (
103+ bandit_clean : dict , pip_fixable : list , monkeypatch : pytest .MonkeyPatch
104+ ) -> None : # type: ignore[type-arg]
98105 monkeypatch .setenv ("PIP_AUDIT_BLOCK_ON" , "none" )
99106 s = Settings ()
100107 assert check_thresholds (bandit_clean , pip_fixable , s ) is False
101108
102109
103- def test_bandit_only_tool_skips_pip (bandit_issues : dict , pip_fixable : list , monkeypatch : pytest .MonkeyPatch ) -> None : # type: ignore[type-arg]
110+ def test_bandit_only_tool_skips_pip (
111+ bandit_issues : dict , pip_fixable : list , monkeypatch : pytest .MonkeyPatch
112+ ) -> None : # type: ignore[type-arg]
104113 monkeypatch .setenv ("TOOLS" , "bandit" )
105114 s = Settings ()
106115 # pip-audit not in enabled tools, so fixable vulns should not block
@@ -109,15 +118,19 @@ def test_bandit_only_tool_skips_pip(bandit_issues: dict, pip_fixable: list, monk
109118 assert result is True
110119
111120
112- def test_pip_only_tool_skips_bandit (bandit_issues : dict , pip_fixable : list , monkeypatch : pytest .MonkeyPatch ) -> None : # type: ignore[type-arg]
121+ def test_pip_only_tool_skips_bandit (
122+ bandit_issues : dict , pip_fixable : list , monkeypatch : pytest .MonkeyPatch
123+ ) -> None : # type: ignore[type-arg]
113124 monkeypatch .setenv ("TOOLS" , "pip-audit" )
114125 s = Settings ()
115126 # bandit not in enabled tools, bandit HIGH issues should not block
116127 result = check_thresholds (bandit_issues , pip_fixable , s )
117128 assert result is True # pip-audit fixable issues do block
118129
119130
120- def test_pip_only_no_bandit_blocking (bandit_issues : dict , pip_clean : list , monkeypatch : pytest .MonkeyPatch ) -> None : # type: ignore[type-arg]
131+ def test_pip_only_no_bandit_blocking (
132+ bandit_issues : dict , pip_clean : list , monkeypatch : pytest .MonkeyPatch
133+ ) -> None : # type: ignore[type-arg]
121134 monkeypatch .setenv ("TOOLS" , "pip-audit" )
122135 s = Settings ()
123136 assert check_thresholds (bandit_issues , pip_clean , s ) is False
@@ -162,7 +175,9 @@ def test_markdown_pip_table(bandit_clean: dict, pip_fixable: list) -> None: # t
162175 assert "GHSA-j8r2-6x86-q33q" in md
163176
164177
165- def test_markdown_run_url (bandit_clean : dict , pip_clean : list , monkeypatch : pytest .MonkeyPatch ) -> None : # type: ignore[type-arg]
178+ def test_markdown_run_url (
179+ bandit_clean : dict , pip_clean : list , monkeypatch : pytest .MonkeyPatch
180+ ) -> None : # type: ignore[type-arg]
166181 monkeypatch .setenv ("GITHUB_REPOSITORY" , "org/repo" )
167182 monkeypatch .setenv ("GITHUB_RUN_ID" , "999" )
168183 s = Settings ()
0 commit comments