Skip to content

test: Verify Poetry v2 lock file groups/markers handling#14724

Merged
markhallen merged 3 commits intomainfrom
poetry-requires-poetry-constraint
Apr 15, 2026
Merged

test: Verify Poetry v2 lock file groups/markers handling#14724
markhallen merged 3 commits intomainfrom
poetry-requires-poetry-constraint

Conversation

@markhallen
Copy link
Copy Markdown
Contributor

What are you trying to accomplish?

Verify that Poetry v2 lock file groups and markers fields are correctly handled during dependency parsing, as part of Poetry v2 support work.

Poetry v2 lock files include new metadata per package:

  • groups (array, e.g. ["main", "dev"]) — replaces the deprecated v1 category field
  • markers (string, e.g. sys_platform == "win32") — environment markers

Investigation confirmed no production code changes are needed — the existing architecture already handles these fields correctly:

  • TomlRB.parse() is a generic TOML parser that passes through arbitrary keys
  • Lock file updates shell out to poetry update --lock, so Poetry CLI regenerates the lock natively
  • Production dependency detection uses poetry show --only main, not lock file fields

This PR adds explicit test coverage to formalize and document that verification.

Anything you want to highlight for special attention from reviewers?

The existing poetry.lock test fixture (python/spec/fixtures/poetry_locks/poetry.lock) was already in Poetry v2 format (generated by Poetry 2.1.1) with groups and markers fields present. The new tests make the implicit coverage explicit by asserting:

  1. Packages with groups field are parsed and included as dependencies
  2. Packages belonging to multiple groups (e.g. ["main", "dev"]) are handled correctly
  3. Packages with markers field are parsed without errors
  4. TomlRB.parse() preserves groups and markers in the parsed output hash

No production code touches lock file fields beyond name, version, source.*, and dependencies — so new fields are harmlessly ignored.

How will you know you've accomplished your goal?

All 48 tests pass (44 existing + 4 new):

bin/test python spec/dependabot/python/file_parser/pyproject_files_parser_spec.rb
# 48 examples, 0 failures

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@markhallen markhallen requested a review from a team as a code owner April 15, 2026 12:24
Copilot AI review requested due to automatic review settings April 15, 2026 12:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit spec coverage to confirm Poetry v2 poetry.lock files containing per-package groups (array) and markers (string) fields continue to parse cleanly and produce expected dependencies, helping formalize behavior as part of ongoing Poetry v2 support work.

Changes:

  • Add parser specs asserting dependencies are still included when groups and/or markers fields are present in Poetry v2 lockfiles.
  • Add a spec asserting TomlRB.parse preserves groups/markers keys in the parsed TOML structure for the existing v2 poetry.lock fixture.
Show a summary per file
File Description
python/spec/dependabot/python/file_parser/pyproject_files_parser_spec.rb Adds new RSpec examples covering Poetry v2 lockfile groups/markers handling and TOML parsing preservation.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

Verify that Poetry v2 lock file fields (groups, markers) are correctly
handled during dependency parsing:

- Packages with groups field are parsed and included
- Packages belonging to multiple groups are handled
- Packages with markers field are parsed correctly
- TomlRB preserves groups and markers in parsed TOML output
@markhallen markhallen force-pushed the poetry-requires-poetry-constraint branch from 5d9680e to c7abc67 Compare April 15, 2026 12:42
@markhallen markhallen enabled auto-merge April 15, 2026 14:31
@markhallen markhallen merged commit d617cbd into main Apr 15, 2026
91 checks passed
@markhallen markhallen deleted the poetry-requires-poetry-constraint branch April 15, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants