Skip to content

Commit a328dc6

Browse files
committed
Return error msgs from ensure_simple correctly
1 parent fdc1070 commit a328dc6

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
@@ -67,7 +67,8 @@ def ensure_simple(
6767
how would one know that it's there?*
6868
"""
6969

70-
def explore_links(page_url, page_name, links_found, msgs):
70+
def explore_links(page_url, page_name, links_found):
71+
msgs = ""
7172
legit_found_links = []
7273
page_content = requests.get(page_url).text
7374
page = html.fromstring(page_content)
@@ -91,15 +92,18 @@ def explore_links(page_url, page_name, links_found, msgs):
9192
msgs += f"\nFound {page_name} link without href {link.text}"
9293
else:
9394
msgs += f"\nFound extra {page_name} link {link.text}"
94-
return legit_found_links
95+
return legit_found_links, msgs
9596

9697
packages_found = {name: False for name in packages.keys()}
9798
releases_found = {name: False for releases in packages.values() for name in releases}
98-
msgs = ""
99-
found_release_links = explore_links(simple_url, "simple", packages_found, msgs)
99+
found_release_links, msgs = explore_links(simple_url, "simple", packages_found)
100100
dl_links = []
101101
for rel_link in found_release_links:
102-
dl_links += explore_links(urljoin(simple_url, rel_link), "release", releases_found, msgs)
102+
new_links, new_msgs = explore_links(
103+
urljoin(simple_url, rel_link), "release", releases_found
104+
)
105+
dl_links += new_links
106+
msgs += new_msgs
103107
for dl_link in dl_links:
104108
package_link, _, sha = dl_link.partition("#sha256=")
105109
if len(sha) != 64:

0 commit comments

Comments
 (0)