From a328dc640485d5354a2490366db82a7c1f41ac04 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 9d672b80..439f2d85 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 87930f59b074134f064abf7ad222ab398882a1c4 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 fefa655b..3034ed49 100644 --- a/pulp_python/app/models.py +++ b/pulp_python/app/models.py @@ -456,6 +456,8 @@ def check_blocklist_for_packages(self, packages): "Blocklisted packages cannot be added to this repository: " "{}".format(", ".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 439f2d85..9d672b80 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: