Skip to content

Commit 5219f1f

Browse files
committed
Return error msgs from ensure_simple correctly
1 parent a7f59a8 commit 5219f1f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pulp_python/tests/functional/utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def ensure_simple(simple_url, packages, sha_digests=None, metadata_sha_digests=N
3939
how would one know that it's there?*
4040
"""
4141

42-
def explore_links(page_url, page_name, links_found, msgs):
42+
def explore_links(page_url, page_name, links_found):
43+
msgs = ""
4344
legit_found_links = []
4445
page = html.fromstring(requests.get(page_url).text)
4546
page_links = page.xpath("/html/body/a")
@@ -57,15 +58,18 @@ def explore_links(page_url, page_name, links_found, msgs):
5758
msgs += f"\nFound {page_name} link without href {link.text}"
5859
else:
5960
msgs += f"\nFound extra {page_name} link {link.text}"
60-
return legit_found_links
61+
return legit_found_links, msgs
6162

6263
packages_found = {name: False for name in packages.keys()}
6364
releases_found = {name: False for releases in packages.values() for name in releases}
64-
msgs = ""
65-
found_release_links = explore_links(simple_url, "simple", packages_found, msgs)
65+
found_release_links, msgs = explore_links(simple_url, "simple", packages_found)
6666
dl_links = []
6767
for rel_link in found_release_links:
68-
dl_links += explore_links(urljoin(simple_url, rel_link), "release", releases_found, msgs)
68+
new_links, new_msgs = explore_links(
69+
urljoin(simple_url, rel_link), "release", releases_found
70+
)
71+
dl_links += new_links
72+
msgs += new_msgs
6973
for dl_link in dl_links:
7074
package_link, _, sha = dl_link.partition("#sha256=")
7175
if len(sha) != 64:

0 commit comments

Comments
 (0)