DEVX-175: fix: honor repo bandit config in badge quality check
Post-merge / detect-and-configure (push) Successful in 13s
Post-merge / release-and-maintain (push) Successful in 1m5s

Co-authored-by: emil User <emil.simeonov@tutanota.com>
This commit was merged in pull request #343.
This commit is contained in:
2026-09-21 19:36:00 +00:00
committed by kireto
parent 3b2a278f87
commit 349057bf5d
3 changed files with 65 additions and 1 deletions
+17
View File
@@ -365,6 +365,23 @@ class TestCollectQuality:
badge = collect_quality(tmp_path)
assert badge["message"] == "A"
@patch("devx.tools.generate_badges.run_command")
def test_bandit_uses_repo_config_when_present(self, mock_run: MagicMock, tmp_path: Path) -> None: # type: ignore[no-untyped-def]
(tmp_path / "pyproject.toml").write_text("[tool.bandit]\nskips = ['B501']\n")
mock_run.return_value = (0, "", "")
collect_quality(tmp_path)
bandit_call = [c for c in mock_run.call_args_list if "bandit" in c.args[0]][0]
assert "-c" in bandit_call.args[0]
assert "pyproject.toml" in bandit_call.args[0]
@patch("devx.tools.generate_badges.run_command")
def test_bandit_plain_invocation_without_repo_config(self, mock_run: MagicMock, tmp_path: Path) -> None: # type: ignore[no-untyped-def]
(tmp_path / "pyproject.toml").write_text("[project]\nname = 'x'\n")
mock_run.return_value = (0, "", "")
collect_quality(tmp_path)
bandit_call = [c for c in mock_run.call_args_list if "bandit" in c.args[0]][0]
assert "-c" not in bandit_call.args[0]
class TestGenerateBadges:
@patch("devx.tools.generate_badges.collect_quality")