File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 11import pytest
2- from dbt .tests .adapter .utils import fixture_cast_bool_to_text , fixture_dateadd , fixture_listagg
2+ from dbt .tests .adapter .utils import (
3+ fixture_cast_bool_to_text ,
4+ fixture_dateadd ,
5+ fixture_listagg ,
6+ fixture_split_part ,
7+ )
38from dbt .tests .adapter .utils .test_any_value import BaseAnyValue
49from dbt .tests .adapter .utils .test_array_append import BaseArrayAppend
510from dbt .tests .adapter .utils .test_array_concat import BaseArrayConcat
@@ -340,7 +345,18 @@ class TestSafeCast(BaseSafeCast):
340345
341346
342347class TestSplitPart (BaseSplitPart ):
343- pass
348+ @pytest .fixture (scope = "class" )
349+ def models (self ):
350+ model_sql = """
351+ -- depends_on: {{ ref('data_split_part') }}
352+ """ + self .interpolate_macro_namespace (
353+ fixture_split_part .models__test_split_part_sql , "split_part"
354+ )
355+
356+ return {
357+ "test_split_part.yml" : fixture_split_part .models__test_split_part_yml ,
358+ "test_split_part.sql" : model_sql ,
359+ }
344360
345361
346362class TestStringLiteral (BaseStringLiteral ):
Original file line number Diff line number Diff line change @@ -55,7 +55,15 @@ def create_secondary_db(self, project):
5555 )
5656
5757 def cleanup_secondary_database (self , project ):
58- drop_sql = "DROP DATABASE IF EXISTS secondary_db"
58+ drop_sql = """
59+ USE [master]
60+
61+ IF EXISTS (SELECT * FROM sys.databases WHERE name = 'secondary_db')
62+ BEGIN
63+ ALTER DATABASE [secondary_db] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
64+ DROP DATABASE [secondary_db]
65+ END
66+ """
5967 with get_connection (project .adapter ):
6068 project .adapter .execute (
6169 drop_sql .format (database = project .database ),
You can’t perform that action at this time.
0 commit comments