Skip to content

Commit

Permalink
Check if driver url or path is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
charalamm committed Feb 27, 2024
1 parent 84a8f1d commit 89f1754
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions terracotta/drivers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def get_driver(
"""
url_or_path = str(url_or_path)
if not url_or_path:
raise ValueError("Database url or path must not be empty")

if provider is None: # try and auto-detect
provider = auto_detect_provider(url_or_path)
Expand Down
2 changes: 1 addition & 1 deletion tests/drivers/test_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_get_driver_invalid():

with pytest.raises(ValueError) as exc:
drivers.get_driver("", provider="foo")
assert "Unknown database provider" in str(exc.value)
assert "Database url or path must not be empty" in str(exc.value)


@pytest.mark.parametrize("provider", TESTABLE_DRIVERS)
Expand Down

0 comments on commit 89f1754

Please sign in to comment.