From d3097e2f446f8e5264df117ed74f45bbded004da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:06:58 +0000 Subject: [PATCH 1/2] build(deps): bump the dependencies group with 3 updates Bumps the dependencies group with 3 updates: [https://github.com/tox-dev/tox-toml-fmt](https://github.com/tox-dev/tox-toml-fmt), [https://github.com/tox-dev/pyproject-fmt](https://github.com/tox-dev/pyproject-fmt) and [https://github.com/astral-sh/ruff-pre-commit](https://github.com/astral-sh/ruff-pre-commit). Updates `https://github.com/tox-dev/tox-toml-fmt` from v1.11.3 to 1.12.0 - [Release notes](https://github.com/tox-dev/tox-toml-fmt/releases) - [Commits](https://github.com/tox-dev/tox-toml-fmt/compare/522f1a9f55dca6596a20adaae2f1f08e61c0f0a4...46786cfddca88dd4430388ec0f72476f0b30ad1a) Updates `https://github.com/tox-dev/pyproject-fmt` from v2.30.6 to 2.31.0 - [Release notes](https://github.com/tox-dev/pyproject-fmt/releases) - [Commits](https://github.com/tox-dev/pyproject-fmt/compare/3c6e76e10abcae02303212289efed3413350769c...cffb8ed78a3d00480dc3851da6176824147baa89) Updates `https://github.com/astral-sh/ruff-pre-commit` from v0.17.4 to 0.17.5 - [Release notes](https://github.com/astral-sh/ruff-pre-commit/releases) - [Commits](https://github.com/astral-sh/ruff-pre-commit/compare/c0f278f1254ccc8fb09676bcdb8d847e7db493e5...ef6cf06c079dd6b299dfc720b0f14400c9d168e1) --- updated-dependencies: - dependency-name: https://github.com/tox-dev/tox-toml-fmt dependency-version: 1.12.0 dependency-type: direct:production dependency-group: dependencies - dependency-name: https://github.com/tox-dev/pyproject-fmt dependency-version: 2.31.0 dependency-type: direct:production dependency-group: dependencies - dependency-name: https://github.com/astral-sh/ruff-pre-commit dependency-version: 0.17.5 dependency-type: direct:production dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8731fa6..6cfa5e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,17 +26,17 @@ repos: - id: codespell priority: 6 - repo: https://github.com/tox-dev/tox-toml-fmt - rev: "522f1a9f55dca6596a20adaae2f1f08e61c0f0a4" # frozen: v1.11.3 + rev: "46786cfddca88dd4430388ec0f72476f0b30ad1a" # frozen: v1.12.0 hooks: - id: tox-toml-fmt priority: 2 - repo: https://github.com/tox-dev/pyproject-fmt - rev: "3c6e76e10abcae02303212289efed3413350769c" # frozen: v2.30.6 + rev: "cffb8ed78a3d00480dc3851da6176824147baa89" # frozen: v2.31.0 hooks: - id: pyproject-fmt priority: 2 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "c0f278f1254ccc8fb09676bcdb8d847e7db493e5" # frozen: v0.17.4 + rev: "ef6cf06c079dd6b299dfc720b0f14400c9d168e1" # frozen: v0.17.5 hooks: - id: ruff-check priority: 3 @@ -54,7 +54,7 @@ repos: - id: simplint priority: 4 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "c0f278f1254ccc8fb09676bcdb8d847e7db493e5" # frozen: v0.17.4 + rev: "ef6cf06c079dd6b299dfc720b0f14400c9d168e1" # frozen: v0.17.5 hooks: - id: ruff-format priority: 5 From 6434d51022408df50b720f50074f25fcaa1e6252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 24 Nov 2026 14:41:18 -0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A7=AA=20test:=20assert=20metadata=20?= =?UTF-8?q?validation=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/_model/test_metadata.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/_model/test_metadata.py b/tests/_model/test_metadata.py index 588f459..74546d3 100644 --- a/tests/_model/test_metadata.py +++ b/tests/_model/test_metadata.py @@ -1,7 +1,7 @@ from __future__ import annotations import pytest -from packaging.metadata import Metadata +from packaging.metadata import InvalidMetadata, Metadata from python_sbom._model._components import component_from_metadata from python_sbom._model._metadata import parse_metadata @@ -66,23 +66,26 @@ def test_project_urls(fields: str, urls: list[tuple[str, str]]) -> None: # the headers of installed distributions that packaging's validating parser rejects, which the SBOM still describes @pytest.mark.parametrize( - ("text", "described"), + ("text", "invalid_fields", "described"), [ pytest.param( "Metadata-Version: 2.1\nName: six\nVersion: 1.17.0\nLicense: MIT\n" "Classifier: License :: OSI Approved :: MIT License\nLicense-File: LICENSE\n", + {"license-file"}, ("six", "1.17.0", ["MIT License", "MIT"]), id="six-license-file-before-2.4", ), pytest.param( "Metadata-Version: 2.1\nName: covdefaults\nVersion: 2.3.0\nLicense: MIT\n" "Description-Content-Type: text/markdown\nLicense-File: LICENSE\nRequires-Dist: coverage (>=6.0.2)\n", + {"license-file"}, ("covdefaults", "2.3.0", ["MIT"]), id="covdefaults-license-file-before-2.4", ), pytest.param( "Metadata-Version: 2.0\nName: ply\nVersion: 3.11\nLicense: BSD\nDescription-Content-Type: UNKNOWN\n" "Platform: UNKNOWN\n", + {"metadata-version", "description-content-type"}, ("ply", "3.11", ["BSD"]), id="ply-unknown-version-and-content-type", ), @@ -90,14 +93,18 @@ def test_project_urls(fields: str, urls: list[tuple[str, str]]) -> None: "Metadata-Version: 2.1\nName: uri-template\nVersion: 1.3.0\nLicense: MIT License\n" "Project-URL: homepage, https://gitlab.linss.com/open-source/python/uri-template\nKeywords: config\n" "License-File: LICENSE\nProvides-Extra: dev\nRequires-Dist: mypy ; extra == 'dev'\n", + {"license-file"}, ("uri-template", "1.3.0", ["MIT License"]), id="uri-template-license-file-before-2.4", ), ], ) -def test_metadata_the_validating_parser_rejects(text: str, described: tuple[str, str, list[str]]) -> None: - with pytest.raises(ExceptionGroup): +def test_metadata_the_validating_parser_rejects( + text: str, invalid_fields: set[str], described: tuple[str, str, list[str]] +) -> None: + with pytest.RaisesGroup(*([InvalidMetadata] * len(invalid_fields))) as rejected: Metadata.from_email(text, validate=True) + assert {error.field for error in rejected.value.exceptions} == invalid_fields component = component_from_metadata(parse_metadata(text)) names = [entry["license"]["name"] for entry in component["licenses"] if "name" in entry["license"]] assert (component["name"], component["version"], names) == described