From 9ae8aae0d92f312874f2f73b9a9c09e4f6560379 Mon Sep 17 00:00:00 2001 From: Myles Hollowed Date: Tue, 22 Oct 2024 20:25:56 -0700 Subject: [PATCH] add regression test for overwriting absolute paths --- .../adapter/simple_seed/test_seed.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/functional/adapter/simple_seed/test_seed.py b/tests/functional/adapter/simple_seed/test_seed.py index 536ed7ad017..18c25713ebf 100644 --- a/tests/functional/adapter/simple_seed/test_seed.py +++ b/tests/functional/adapter/simple_seed/test_seed.py @@ -386,3 +386,27 @@ def test_empty_seeds(self, project): class TestEmptySeed(BaseTestEmptySeed): pass + + +class TestAbsoluteSeedPaths: + """ + This is a regression test for issue #10886. + We're ensuring that dbt will not overwrite files that are passed in as asbolute paths in dbt_project.yml + """ + + @pytest.fixture(scope="class") + def project_config_update(self, project_root): + # Assign an absolute path to seed-paths + return { + "seed-paths": [str(Path(project_root) / "seeds")], + } + + @pytest.fixture(scope="class") + def seeds(self): + return {"my_seed.csv": seed__with_dots_csv} + + def test_absolute_seeds_paths(self, project): + results = run_dbt(["seed"]) + assert len(results) == 1 + # Should not fail due to file being overwritten + results = run_dbt(["seed"])