From 5a8015f09a7f61ad5b01c6b4999ac0f83f9c4cfe Mon Sep 17 00:00:00 2001 From: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:28:59 -0500 Subject: [PATCH] Mcknight/fix python model test (#717) * update RELEASE_BRANCH env * add teardown_method to clean up hanging artfiact after test runs (cherry picked from commit c58c54d8615e578c3e834cd6f359d76d4317eb81) --- tests/functional/adapter/test_python_model.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/functional/adapter/test_python_model.py b/tests/functional/adapter/test_python_model.py index b91f3c9c1..ea67e6c1c 100644 --- a/tests/functional/adapter/test_python_model.py +++ b/tests/functional/adapter/test_python_model.py @@ -126,6 +126,15 @@ class TestCustomSchemaWorks: def models(self): return {"custom_target_model.py": models__custom_target_model} + @pytest.fixture(scope="function", autouse=True) + def teardown_method(self, project): + yield + with project.adapter.connection_named("__test"): + relation = project.adapter.Relation.create( + database=project.database, schema=f"{project.test_schema}_MY_CUSTOM_SCHEMA" + ) + project.adapter.drop_schema(relation) + def test_custom_target(self, project): results = run_dbt() assert results[0].node.schema == f"{project.test_schema}_MY_CUSTOM_SCHEMA"