Skip to content

Commit d2628e7

Browse files
ruromeroclaude
andcommitted
fix(test): pin pip transitive deps to prevent version drift in fixtures
Transitive dependencies (idna, charset-normalizer, urllib3, certifi, pysocks) were resolved live from PyPI, causing test failures when new versions are published (e.g. idna 3.11 -> 3.12). Pin all deps with == in the test pyproject.toml, matching the lock file approach used by uv and poetry tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent acf06da commit d2628e7

4 files changed

Lines changed: 89 additions & 14 deletions

File tree

test/providers/python_pyproject.test.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,19 @@ suite('testing the python-pyproject data provider', () => {
272272
let result = await pipProvider.provideStack(path.join(pipFixtureDir, 'pyproject.toml'))
273273
let sbom = JSON.parse(result.content)
274274
let rootDep = sbom.dependencies.find(d => d.ref.includes('/test-project@'))
275-
expect(rootDep.dependsOn).to.have.lengthOf(1)
276-
expect(rootDep.dependsOn[0]).to.include('/requests@')
275+
let directNames = rootDep.dependsOn.map(d => d.split('/').pop().split('@')[0])
276+
expect(directNames).to.include('requests')
277+
expect(directNames).to.include('charset-normalizer')
278+
expect(directNames).to.include('idna')
279+
expect(directNames).to.include('urllib3')
280+
expect(directNames).to.include('certifi')
281+
expect(directNames).to.include('pysocks')
277282
let requestsDep = sbom.dependencies.find(d => d.ref.includes('/requests@'))
278-
let transNames = requestsDep.dependsOn.map(d => d.split('/').pop().split('@')[0])
279-
expect(transNames).to.include('certifi')
280-
expect(transNames).to.include('charset-normalizer')
281-
expect(transNames).to.include('idna')
282-
expect(transNames).to.include('urllib3')
283+
let reqTransNames = requestsDep.dependsOn.map(d => d.split('/').pop().split('@')[0])
284+
expect(reqTransNames).to.include('certifi')
285+
expect(reqTransNames).to.include('charset-normalizer')
286+
expect(reqTransNames).to.include('idna')
287+
expect(reqTransNames).to.include('urllib3')
283288
}).timeout(TIMEOUT)
284289

285290
/** Verifies exhortignore marker produces expected SBOM for stack and component analysis. */

test/providers/tst_manifests/pyproject/pip_pep621/expected_component_sbom.json

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,78 @@
1919
"purl": "pkg:pypi/requests@2.32.3",
2020
"type": "library",
2121
"bom-ref": "pkg:pypi/requests@2.32.3"
22+
},
23+
{
24+
"name": "charset-normalizer",
25+
"version": "3.4.7",
26+
"purl": "pkg:pypi/charset-normalizer@3.4.7",
27+
"type": "library",
28+
"bom-ref": "pkg:pypi/charset-normalizer@3.4.7"
29+
},
30+
{
31+
"name": "idna",
32+
"version": "3.12",
33+
"purl": "pkg:pypi/idna@3.12",
34+
"type": "library",
35+
"bom-ref": "pkg:pypi/idna@3.12"
36+
},
37+
{
38+
"name": "urllib3",
39+
"version": "2.6.3",
40+
"purl": "pkg:pypi/urllib3@2.6.3",
41+
"type": "library",
42+
"bom-ref": "pkg:pypi/urllib3@2.6.3"
43+
},
44+
{
45+
"name": "certifi",
46+
"version": "2026.2.25",
47+
"purl": "pkg:pypi/certifi@2026.2.25",
48+
"type": "library",
49+
"bom-ref": "pkg:pypi/certifi@2026.2.25"
50+
},
51+
{
52+
"name": "pysocks",
53+
"version": "1.7.1",
54+
"purl": "pkg:pypi/pysocks@1.7.1",
55+
"type": "library",
56+
"bom-ref": "pkg:pypi/pysocks@1.7.1"
2257
}
2358
],
2459
"dependencies": [
2560
{
2661
"ref": "pkg:pypi/test-project@1.0.0",
2762
"dependsOn": [
28-
"pkg:pypi/requests@2.32.3"
63+
"pkg:pypi/requests@2.32.3",
64+
"pkg:pypi/charset-normalizer@3.4.7",
65+
"pkg:pypi/idna@3.12",
66+
"pkg:pypi/urllib3@2.6.3",
67+
"pkg:pypi/certifi@2026.2.25",
68+
"pkg:pypi/pysocks@1.7.1"
2969
]
3070
},
3171
{
3272
"ref": "pkg:pypi/requests@2.32.3",
3373
"dependsOn": []
74+
},
75+
{
76+
"ref": "pkg:pypi/charset-normalizer@3.4.7",
77+
"dependsOn": []
78+
},
79+
{
80+
"ref": "pkg:pypi/idna@3.12",
81+
"dependsOn": []
82+
},
83+
{
84+
"ref": "pkg:pypi/urllib3@2.6.3",
85+
"dependsOn": []
86+
},
87+
{
88+
"ref": "pkg:pypi/certifi@2026.2.25",
89+
"dependsOn": []
90+
},
91+
{
92+
"ref": "pkg:pypi/pysocks@1.7.1",
93+
"dependsOn": []
3494
}
3595
]
3696
}

test/providers/tst_manifests/pyproject/pip_pep621/expected_stack_sbom.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
},
3030
{
3131
"name": "idna",
32-
"version": "3.11",
33-
"purl": "pkg:pypi/idna@3.11",
32+
"version": "3.12",
33+
"purl": "pkg:pypi/idna@3.12",
3434
"type": "library",
35-
"bom-ref": "pkg:pypi/idna@3.11"
35+
"bom-ref": "pkg:pypi/idna@3.12"
3636
},
3737
{
3838
"name": "urllib3",
@@ -60,14 +60,19 @@
6060
{
6161
"ref": "pkg:pypi/test-project@1.0.0",
6262
"dependsOn": [
63-
"pkg:pypi/requests@2.32.3"
63+
"pkg:pypi/requests@2.32.3",
64+
"pkg:pypi/charset-normalizer@3.4.7",
65+
"pkg:pypi/idna@3.12",
66+
"pkg:pypi/urllib3@2.6.3",
67+
"pkg:pypi/certifi@2026.2.25",
68+
"pkg:pypi/pysocks@1.7.1"
6469
]
6570
},
6671
{
6772
"ref": "pkg:pypi/requests@2.32.3",
6873
"dependsOn": [
6974
"pkg:pypi/charset-normalizer@3.4.7",
70-
"pkg:pypi/idna@3.11",
75+
"pkg:pypi/idna@3.12",
7176
"pkg:pypi/urllib3@2.6.3",
7277
"pkg:pypi/certifi@2026.2.25",
7378
"pkg:pypi/pysocks@1.7.1"
@@ -78,7 +83,7 @@
7883
"dependsOn": []
7984
},
8085
{
81-
"ref": "pkg:pypi/idna@3.11",
86+
"ref": "pkg:pypi/idna@3.12",
8287
"dependsOn": []
8388
},
8489
{

test/providers/tst_manifests/pyproject/pip_pep621/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ version = "1.0.0"
44
requires-python = ">=3.9"
55
dependencies = [
66
"requests[socks]==2.32.3",
7+
"charset-normalizer==3.4.7",
8+
"idna==3.12",
9+
"urllib3[socks]==2.6.3",
10+
"certifi==2026.2.25",
11+
"pysocks==1.7.1",
712
]

0 commit comments

Comments
 (0)