From 1911f64b68cc6a67874d7cfee552e4029fec5b4e Mon Sep 17 00:00:00 2001 From: Jitka Halova Date: Thu, 8 Jan 2026 14:16:10 +0100 Subject: [PATCH 1/2] Return error msgs from ensure_simple correctly --- pulp_python/tests/functional/utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pulp_python/tests/functional/utils.py b/pulp_python/tests/functional/utils.py index 09a19c15..5887d57f 100644 --- a/pulp_python/tests/functional/utils.py +++ b/pulp_python/tests/functional/utils.py @@ -67,7 +67,8 @@ def ensure_simple( how would one know that it's there?* """ - def explore_links(page_url, page_name, links_found, msgs): + def explore_links(page_url, page_name, links_found): + msgs = "" legit_found_links = [] page_content = requests.get(page_url).text page = html.fromstring(page_content) @@ -91,15 +92,18 @@ def explore_links(page_url, page_name, links_found, msgs): msgs += f"\nFound {page_name} link without href {link.text}" else: msgs += f"\nFound extra {page_name} link {link.text}" - return legit_found_links + return legit_found_links, msgs packages_found = {name: False for name in packages.keys()} releases_found = {name: False for releases in packages.values() for name in releases} - msgs = "" - found_release_links = explore_links(simple_url, "simple", packages_found, msgs) + found_release_links, msgs = explore_links(simple_url, "simple", packages_found) dl_links = [] for rel_link in found_release_links: - dl_links += explore_links(urljoin(simple_url, rel_link), "release", releases_found, msgs) + new_links, new_msgs = explore_links( + urljoin(simple_url, rel_link), "release", releases_found + ) + dl_links += new_links + msgs += new_msgs for dl_link in dl_links: package_link, _, sha = dl_link.partition("#sha256=") if len(sha) != 64: From 7dc65324a88533b00b836ccd58234288768126ba Mon Sep 17 00:00:00 2001 From: Jitka Halova Date: Mon, 20 Apr 2026 14:05:06 +0200 Subject: [PATCH 2/2] tmp: revert --- pulp_python/app/models.py | 2 ++ pulp_python/tests/functional/utils.py | 14 +++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pulp_python/app/models.py b/pulp_python/app/models.py index fa45835d..1ec77ec7 100644 --- a/pulp_python/app/models.py +++ b/pulp_python/app/models.py @@ -458,6 +458,8 @@ def check_blocklist_for_packages(self, packages): ", ".join(blocked) ) ) + if False: + raise ValidationError() class PythonBlocklistEntry(BaseModel): diff --git a/pulp_python/tests/functional/utils.py b/pulp_python/tests/functional/utils.py index 5887d57f..09a19c15 100644 --- a/pulp_python/tests/functional/utils.py +++ b/pulp_python/tests/functional/utils.py @@ -67,8 +67,7 @@ def ensure_simple( how would one know that it's there?* """ - def explore_links(page_url, page_name, links_found): - msgs = "" + def explore_links(page_url, page_name, links_found, msgs): legit_found_links = [] page_content = requests.get(page_url).text page = html.fromstring(page_content) @@ -92,18 +91,15 @@ def explore_links(page_url, page_name, links_found): msgs += f"\nFound {page_name} link without href {link.text}" else: msgs += f"\nFound extra {page_name} link {link.text}" - return legit_found_links, msgs + return legit_found_links packages_found = {name: False for name in packages.keys()} releases_found = {name: False for releases in packages.values() for name in releases} - found_release_links, msgs = explore_links(simple_url, "simple", packages_found) + msgs = "" + found_release_links = explore_links(simple_url, "simple", packages_found, msgs) dl_links = [] for rel_link in found_release_links: - new_links, new_msgs = explore_links( - urljoin(simple_url, rel_link), "release", releases_found - ) - dl_links += new_links - msgs += new_msgs + dl_links += explore_links(urljoin(simple_url, rel_link), "release", releases_found, msgs) for dl_link in dl_links: package_link, _, sha = dl_link.partition("#sha256=") if len(sha) != 64: