Skip to content

Commit

Permalink
Ensure audb.versions() is not failing (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw authored Jun 3, 2024
1 parent 075b279 commit 13c3019
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions audb/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,6 @@ def versions(
backend_interface = repository.create_backend_interface()
with backend_interface.backend as backend:
if repository.backend == "artifactory":
import artifactory

# Do not use `backend_interface.versions()` on Artifactory,
# as calling `backend_interface.ls()` is slow on Artifactory,
# see https://github.com/devopshq/artifactory/issues/423.
Expand All @@ -602,8 +600,11 @@ def versions(
header = p.joinpath(f"db-{version}.yaml")
if header.exists():
vs.extend([version])
except artifactory.ArtifactoryException: # pragma: nocover
# This tackles the case of missing read permissions.
except Exception: # pragma: nocover
# Might happen,
# if a database is not available on the backend,
# or we don't have read permissions.
#
# We cannot test this at the moment
# on the public Artifactory server.
# Because after trying
Expand Down

0 comments on commit 13c3019

Please sign in to comment.