@@ -6131,22 +6131,20 @@ def setup_senario(model_before: str, model_after: str):
61316131 )
61326132
61336133
6134- @pytest .mark .isolated
6134+ @pytest .mark .set_default_connection ( disable = True )
61356135def test_missing_connection_config ():
6136- # This is the actual implementation of Config._get_connection which would be used in a real project
6137- # To make testing easier, it's mocked at tests/__init__.py
6138-
6139- with mock .patch .object (Config , "get_connection" , Config .original_get_connection ):
6140- # Case 1: No default_connection or gateways specified should raise a ConfigError
6141- with pytest .raises (ConfigError ):
6142- ctx = Context (config = Config ())
6143-
6144- # Case 2: No connection specified in the gateway should raise a ConfigError
6145- with pytest .raises (ConfigError ):
6146- ctx = Context (config = Config (gateways = {"default" : GatewayConfig ()}))
6147-
6148- # Case 3: Specifying a default_connection or connection in the gateway should work
6149- ctx = Context (config = Config (default_connection = DuckDBConnectionConfig ()))
6150- ctx = Context (
6151- config = Config (gateways = {"default" : GatewayConfig (connection = DuckDBConnectionConfig ())})
6152- )
6136+ # This is testing the actual implementation of Config.get_connection
6137+ # To make writing tests easier, it's patched by the autouse fixture provide_sqlmesh_default_connection
6138+ # Case 1: No default_connection or gateways specified should raise a ConfigError
6139+ with pytest .raises (ConfigError ):
6140+ ctx = Context (config = Config ())
6141+
6142+ # Case 2: No connection specified in the gateway should raise a ConfigError
6143+ with pytest .raises (ConfigError ):
6144+ ctx = Context (config = Config (gateways = {"incorrect" : GatewayConfig ()}))
6145+
6146+ # Case 3: Specifying a default_connection or connection in the gateway should work
6147+ ctx = Context (config = Config (default_connection = DuckDBConnectionConfig ()))
6148+ ctx = Context (
6149+ config = Config (gateways = {"default" : GatewayConfig (connection = DuckDBConnectionConfig ())})
6150+ )
0 commit comments