-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db0db71
commit e2cf7af
Showing
10 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def test_top_level_directories(models): | ||
for model in models: | ||
top_level_dir = model["path"].split("/")[0] | ||
assert top_level_dir in [ | ||
"staging", | ||
"intermediate", | ||
"marts", | ||
], f"{model['unique_id']} is located in `{top_level_dir}`, this is not a valid top-level directory." |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from contextlib import nullcontext as does_not_raise | ||
|
||
import pytest | ||
|
||
from dbt_bouncer.tests.test_project_directories import test_top_level_directories | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"models, expectation", | ||
[ | ||
( | ||
[ | ||
{ | ||
"path": "staging/model_1.sql", | ||
"unique_id": "model.package_name.model_1", | ||
} | ||
], | ||
does_not_raise(), | ||
), | ||
( | ||
[ | ||
{ | ||
"path": "intermediate/model_1.sql", | ||
"unique_id": "model.package_name.model_1", | ||
} | ||
], | ||
does_not_raise(), | ||
), | ||
( | ||
[ | ||
{ | ||
"path": "marts/model_1.sql", | ||
"unique_id": "model.package_name.model_1", | ||
} | ||
], | ||
does_not_raise(), | ||
), | ||
( | ||
[ | ||
{ | ||
"path": "model_1.sql", | ||
"unique_id": "model.package_name.model_1", | ||
} | ||
], | ||
pytest.raises(AssertionError), | ||
), | ||
( | ||
[ | ||
{ | ||
"path": "aggregation/model_1.sql", | ||
"unique_id": "model.package_name.model_1", | ||
} | ||
], | ||
pytest.raises(AssertionError), | ||
), | ||
], | ||
) | ||
def test_test_top_level_directories(models, expectation): | ||
with expectation: | ||
test_top_level_directories(models=models) |