diff --git a/terracotta/drivers/__init__.py b/terracotta/drivers/__init__.py index 2a404568..08971aa6 100644 --- a/terracotta/drivers/__init__.py +++ b/terracotta/drivers/__init__.py @@ -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) diff --git a/tests/drivers/test_drivers.py b/tests/drivers/test_drivers.py index 8ec191af..6e660f71 100644 --- a/tests/drivers/test_drivers.py +++ b/tests/drivers/test_drivers.py @@ -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)