Skip to content

Commit 5664844

Browse files
committed
Return error msgs from ensure_simple correctly
1 parent 04ac92d commit 5664844

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
@@ -38,7 +38,8 @@ def ensure_simple(simple_url, packages, sha_digests=None, metadata_sha_digests=N
3838
how would one know that it's there?*
3939
"""
4040

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

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

0 commit comments

Comments
 (0)