:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(batch-exports): mock databricks connect in test (#57718)
Raúl Negrón-Oterod2dc3f4c8645
diff --git a/products/batch_exports/backend/tests/temporal/destinations/databricks/test_client.py b/products/batch_exports/backend/tests/temporal/destinations/databricks/test_client.pyindex 09aa88e5e89a..8c2661fe6f80 100644--- a/products/batch_exports/backend/tests/temporal/destinations/databricks/test_client.py+++ b/products/batch_exports/backend/tests/temporal/destinations/databricks/test_client.py@@ -1,4 +1,5 @@import pytest+import unittest.mockfrom products.batch_exports.backend.temporal.destinations.databricks_batch_export import (DatabricksClient,@@ -185,9 +186,13 @@ async def test_connect_when_invalid_host():catalog="test",schema="test",)- with pytest.raises(- DatabricksConnectionError,- match="Failed to connect to Databricks. Please check that your connection details are valid.",+ with unittest.mock.patch(+ "products.batch_exports.backend.temporal.destinations.databricks_batch_export.sql.connect",+ side_effect=ValueError("invalid host"),):- async with client.connect():- pass+ with pytest.raises(+ DatabricksConnectionError,+ match="Failed to connect to Databricks. Please check that your connection details are valid.",+ ):+ async with client.connect():+ pass