Skip to content

Commit 4794e5c

Browse files
authored
Create helper method to handle test map deletion (#27)
* Create helper method to handle test map deletion Signed-off-by: Jono Yang <jyang@nexb.com> * Update requirements-dev.txt Signed-off-by: Jono Yang <jyang@nexb.com> --------- Signed-off-by: Jono Yang <jyang@nexb.com>
1 parent 9bc3e43 commit 4794e5c

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

requirements-dev.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@ aboutcode-toolkit==11.1.1
22
alabaster==1.0.0
33
anyio==4.11.0
44
babel==2.17.0
5+
backports.tarfile==1.2.0
56
boolean.py==5.0
67
cffi==2.0.0
78
colorama==0.4.6
89
cryptography==46.0.3
910
doc8==2.0.0
1011
docutils==0.21.2
1112
et_xmlfile==2.0.0
13+
exceptiongroup==1.3.0
1214
execnet==2.1.1
1315
h11==0.16.0
1416
id==1.5.0
1517
imagesize==1.4.1
18+
importlib_metadata==8.7.0
1619
iniconfig==2.3.0
1720
jaraco.classes==3.4.0
1821
jaraco.context==6.0.1
@@ -39,17 +42,16 @@ requests-toolbelt==1.0.0
3942
restructuredtext_lint==1.4.0
4043
rfc3986==2.0.0
4144
rich==14.2.0
42-
roman-numerals-py==3.1.0
4345
ruff==0.14.2
4446
secretstorage==3.4.0
4547
sniffio==1.3.1
4648
snowballstemmer==3.0.1
47-
sphinx==8.2.3
48-
sphinx-autobuild==2025.8.25
49+
sphinx==8.1.3
50+
sphinx-autobuild==2024.10.3
4951
sphinx-copybutton==0.5.2
50-
sphinx-reredirects==1.0.0
5152
sphinx-rtd-dark-mode==1.3.0
5253
sphinx-rtd-theme==3.0.2
54+
sphinx_reredirects==0.1.6
5355
sphinxcontrib-applehelp==2.0.0
5456
sphinxcontrib-devhelp==2.0.0
5557
sphinxcontrib-htmlhelp==2.1.0
@@ -59,7 +61,9 @@ sphinxcontrib-qthelp==2.0.0
5961
sphinxcontrib-serializinghtml==2.0.0
6062
starlette==0.48.0
6163
stevedore==5.5.0
64+
tomli==2.3.0
6265
twine==6.2.0
6366
uvicorn==0.38.0
6467
watchfiles==1.1.1
65-
websockets==15.0.1
68+
websockets==15.0.1
69+
zipp==3.23.0

tests/test_purl_validator.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ def tearDown(self):
3434
fileutils.delete(purl_map.parent)
3535
return super().tearDown()
3636

37+
def create_purl_map(self, purls):
38+
purl_map_loc = purl_validator.create_purl_map(purls)
39+
self.created_purl_maps.append(purl_map_loc)
40+
return purl_map_loc
41+
3742
def test_purl_validator_create_purl_map_entry(self):
3843
test_purl1 = PackageURL(type="npm", namespace="@test", name="test", version="1.0")
3944
test_purl2 = "pkg:npm/test2@2.0"
@@ -56,16 +61,14 @@ def test_purl_validator_create_purl_map_entry(self):
5661
test_purl4 = []
5762
purls = [test_purl1, test_purl2]
5863

59-
purl_map_loc = purl_validator.create_purl_map(purls)
60-
self.created_purl_maps.append(purl_map_loc)
61-
64+
purl_map_loc = self.create_purl_map(purls)
6265
purl_map = purl_validator.PurlValidator.load_map(purl_map_loc)
6366
expected_results = [(b"npm/@test/test", 1), (b"npm/test2", 1)]
6467
results = [(k, v) for k, v in purl_map.items()]
6568
self.assertEqual(expected_results, results)
6669

6770
with self.assertRaises(ValueError):
68-
purl_validator.create_purl_map([test_purl3])
71+
self.create_purl_map([test_purl3])
6972

7073
with self.assertRaises(ValueError):
71-
purl_validator.create_purl_map([test_purl4])
74+
self.create_purl_map([test_purl4])

0 commit comments

Comments
 (0)