Skip to content

fix(tests): keep the test suite and compdb frontend working on Python 3.15 - #41

Closed
Frauschi wants to merge 2 commits into
masterfrom
fix/python-315-compat
Closed

Frauschi wants to merge 2 commits into
masterfrom
fix/python-315-compat

Conversation

@Frauschi

Copy link
Copy Markdown
Member

selftest.yml uses python-version: '3.x', so CI starts failing as soon as setup-python resolves to 3.15.

  • tests/test_low_findings.py called SourceFileLoader.load_module(), which 3.15 removed, so the whole suite failed to load. It now uses spec_from_loader + exec_module, like the other test files.
  • compdb_sbom.py passed maxsplit to re.split positionally, which 3.13 deprecated. It now passes it by keyword.

Tested on Python 3.9.6, 3.14 and 3.15.0, the compdb change also with -W error::DeprecationWarning.

Python 3.15 removed SourceFileLoader.load_module(), so the module-level
imports in tests/test_low_findings.py raise AttributeError and the whole
suite fails to load. selftest.yml floats on python-version '3.x', so CI
breaks as soon as setup-python resolves to 3.15.

Load gen-sbom, sbom-driver.py and compdb_sbom.py through
spec_from_loader + exec_module, the shape test_gen_sbom.py and
test_sbom_identity.py already use, and do the same in the /dev/stdout
subprocess snippet.

Tested on Python 3.9.6, 3.14 and 3.15.0.
macro_name() passed maxsplit to re.split positionally. Python 3.13
deprecated that form and a later release will reject it, which would
break the compile_commands.json frontend in every product that vendors
it. Passing it by keyword works on every supported Python.

Tested with -W error::DeprecationWarning on Python 3.9.6, 3.14 and
3.15.0.
Copilot AI balanced review requested due to automatic review settings October 19, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused compatibility changes preserve intended behavior, with no identified blocking issues.

No open issues 🎉

What changed in this PR

Updates test loading and the compilation-database frontend for Python 3.15 compatibility.

Changes:

  • Replaces removed load_module() calls with exec_module().
  • Passes re.split’s maxsplit argument by keyword to avoid deprecation warnings.
File Description
tests/​test_low_findings.py Modernizes module loading in tests and subprocess code.
share/​frontends/​compdb_sbom.py Uses keyword syntax for maxsplit.

Review effort: Balanced

@Frauschi

Copy link
Copy Markdown
Member Author

Closing as #36 now contains the same fixes and will go in first.

@Frauschi Frauschi closed this Oct 21, 2026
@Frauschi
Frauschi deleted the fix/python-315-compat branch October 22, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants