mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-07-07 12:11:34 +00:00
Strip environment markers from detected uv dependency pins (#938)
## Summary - strip PEP 508 environment markers before extracting uv versions from dependency entries - cover dependency-group pins with and without whitespace before the marker - cover requirements-style pins with markers Fixes #920 ## Validation - npm ci --ignore-scripts - npm run all Refs: pi-session 019f316a-4108-7975-892f-ee5bf8abc7c3
This commit is contained in:
committed by
GitHub
parent
17c398959b
commit
d31148d669
@@ -1,5 +1,9 @@
|
||||
import { expect, test } from "@jest/globals";
|
||||
import { getUvVersionFromFile } from "../../src/version/file-parser";
|
||||
import {
|
||||
getUvVersionFromPyprojectContent,
|
||||
getUvVersionFromRequirementsText,
|
||||
} from "../../src/version/requirements-file";
|
||||
|
||||
test("ignores dependencies starting with uv", async () => {
|
||||
const parsedVersion = getUvVersionFromFile(
|
||||
@@ -7,3 +11,24 @@ test("ignores dependencies starting with uv", async () => {
|
||||
);
|
||||
expect(parsedVersion).toBe("0.6.17");
|
||||
});
|
||||
|
||||
test.each([
|
||||
["without space before marker", "uv==0.11.20; sys_platform != 'emscripten'"],
|
||||
["with space before marker", "uv==0.11.20 ; sys_platform != 'emscripten'"],
|
||||
])("strips PEP 508 markers from pyproject dependency groups %s", (_, dependency) => {
|
||||
const parsedVersion = getUvVersionFromPyprojectContent(`[dependency-groups]
|
||||
test = [
|
||||
"${dependency}",
|
||||
]
|
||||
`);
|
||||
|
||||
expect(parsedVersion).toBe("==0.11.20");
|
||||
});
|
||||
|
||||
test("strips PEP 508 markers from requirements dependencies", () => {
|
||||
const parsedVersion = getUvVersionFromRequirementsText(
|
||||
"uv==0.11.20; sys_platform != 'emscripten'",
|
||||
);
|
||||
|
||||
expect(parsedVersion).toBe("==0.11.20");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user