Skip to content

Commit

Permalink
Clear up version check in conftest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Qalthos committed Feb 26, 2025
1 parent dd27807 commit a3795e1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,16 @@ def check_download_collection(name: str, dest: Path) -> None:
namespace, name = name.split(".")
base_url = "https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections"

url = f"{base_url}/index/{namespace}/{name}/versions/?is_highest=true"
url = f"{base_url}/index/{namespace}/{name}/"
try:
with urlopen(url) as response: # noqa: S310
body = response.read()
except HTTPError:
err = f"Failed to check collection version: {name}"
pytest.fail(err)
with urlopen(url) as response: # noqa: S310
body = response.read()

json_response = json.loads(body)
version = json_response["data"][0]["version"]
version = json_response["highest_version"]["version"]
file_name = f"{namespace}-{name}-{version}.tar.gz"
file_path = dest / file_name
if file_path.exists():
Expand Down

0 comments on commit a3795e1

Please sign in to comment.