Skip to content

Add comprehensive test coverage for UV detector#1758

Open
bd-spratikbharti wants to merge 6 commits into
masterfrom
IDETECT-5128
Open

Add comprehensive test coverage for UV detector#1758
bd-spratikbharti wants to merge 6 commits into
masterfrom
IDETECT-5128

Conversation

@bd-spratikbharti
Copy link
Copy Markdown
Collaborator

@bd-spratikbharti bd-spratikbharti commented May 13, 2026

Description

Summary

Adds unit, functional, and battery tests for the UV detector.

Test Coverage Added

Unit Tests

  • UVBuildExtractorTest: Command argument building for --group, --no-group, --all-groups flags;
    detect.uv.dependency.groups.included behavior (single group, multiple groups, ALL keyword case-insensitive);
    conflict resolution when a group appears in both included and excluded lists (excluded takes precedence);
    edge case — ALL keyword combined with explicit exclusions
  • UVLockParserTest: Lock file parsing, dev/optional dependency group exclusion, workspace member filtering, version normalization, transitive dependencies
  • UVTreeDependencyGraphTransformerTest: Tree output parsing, workspace member include/exclude handling
  • UVTomlParserTest: Project configuration parsing from pyproject.toml

Functional Tests

  • UVDetectableFunctionalTest — baseline detection (pre-existing)
  • UVExcludeDevGroupsFunctionalTest — dev group exclusion via build detector

Battery Tests

  • uv-simple — single-package UV project
  • uv-devdeps — project with dev group dependencies
  • uv-workspace — multi-member UV workspace

Notes

  • detect.uv.dependency.groups.included is only supported by the UV Build Detector (CLI mode).
    Lockfile detector support is tracked separately; placeholder comments added in relevant tests.

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 unit/functional/battery test coverage for the UV (Python package manager) detector to validate argument building, parsing of uv tree output, parsing of uv.lock, and end-to-end detection via battery fixtures.

Changes:

  • Added unit tests for UV CLI argument construction and UV parsers/transformers (TOML, lockfile, tree output).
  • Added a functional test for excluding dev dependency groups via --no-group.
  • Added new battery fixtures (sample UV projects + expected BDIO) and a UVBattery test suite to run them.

Reviewed changes

Copilot reviewed 14 out of 73 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/test/resources/battery/uv-workspace/uv-tree.xout Battery fixture: uv tree output for a multi-member workspace.
src/test/resources/battery/uv-workspace/pyproject.toml Battery fixture: root workspace pyproject.toml with [tool.uv.workspace].
src/test/resources/battery/uv-workspace/lib-utils/pyproject.toml Battery fixture: workspace member project definition.
src/test/resources/battery/uv-workspace/lib-core/pyproject.toml Battery fixture: workspace member project definition.
src/test/resources/battery/uv-simple/uv-tree.xout Battery fixture: uv tree output for a simple project.
src/test/resources/battery/uv-simple/pyproject.toml Battery fixture: simple UV-managed pyproject.toml.
src/test/resources/battery/uv-devdeps/uv-tree.xout Battery fixture: uv tree output including dev-group dependencies.
src/test/resources/battery/uv-devdeps/pyproject.toml Battery fixture: project with optional dev dependencies.
src/test/java/com/blackduck/integration/detect/battery/detector/UVBattery.java New battery test runner for uv-simple/uv-devdeps/uv-workspace scenarios.
detectable/src/test/java/com/blackduck/integration/detectable/detectables/uv/unit/UVTreeDependencyGraphTransformerTest.java Unit tests for parsing uv tree output into dependency graphs/code locations.
detectable/src/test/java/com/blackduck/integration/detectable/detectables/uv/unit/UVTomlParserTest.java Unit tests for pyproject.toml parsing (name/version, managed flag).
detectable/src/test/java/com/blackduck/integration/detectable/detectables/uv/unit/UVLockParserTest.java Unit tests for parsing uv.lock into graphs (groups, workspaces, transitives).
detectable/src/test/java/com/blackduck/integration/detectable/detectables/uv/unit/UVBuildExtractorTest.java Unit tests for uv tree CLI argument building (groups include/exclude, conflicts, all).
detectable/src/test/java/com/blackduck/integration/detectable/detectables/uv/functional/UVExcludeDevGroupsFunctionalTest.java Functional test validating end-to-end dev group exclusion behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bd-spratikbharti bd-spratikbharti self-assigned this May 14, 2026
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.

2 participants