Manifest Checks: Unit Tests#
Note
The below checks require manifest.json
to be present.
Classes:
Name | Description |
---|---|
CheckUnitTestCoverage |
Set the minimum percentage of models that have a unit test. |
CheckUnitTestExpectFormats |
Unit tests can only use the specified formats. |
CheckUnitTestGivenFormats |
Unit tests can only use the specified formats. |
CheckUnitTestCoverage
#
Set the minimum percentage of models that have a unit test.
Warning
This check is only supported for dbt 1.8.0 and above.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min_unit_test_coverage_pct
|
float
|
The minimum percentage of models that must have a unit test. |
required |
Receives at execution time:
Name | Type | Description |
---|---|---|
models |
List[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
unit_tests |
List[UnitTests]
|
List of UnitTests objects parsed from |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
include |
Optional[str]
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_unit_tests.py
CheckUnitTestExpectFormats
#
Unit tests can only use the specified formats.
Warning
This check is only supported for dbt 1.8.0 and above.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
permitted_formats
|
Optional[List[Literal['csv', 'dict', 'sql']]]
|
A list of formats that are allowed to be used for |
required |
Receives at execution time:
Name | Type | Description |
---|---|---|
manifest_obj |
DbtBouncerManifest
|
The DbtBouncerManifest object parsed from |
unit_test |
UnitTests
|
The UnitTests object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the unit test path (i.e the .yml file where the unit test is configured). Unit test paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the unit test path (i.e the .yml file where the unit test is configured). Only unit test paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/check_unit_tests.py
CheckUnitTestGivenFormats
#
Unit tests can only use the specified formats.
Warning
This check is only supported for dbt 1.8.0 and above.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
permitted_formats
|
Optional[List[Literal['csv', 'dict', 'sql']]]
|
A list of formats that are allowed to be used for |
required |
Receives at execution time:
Name | Type | Description |
---|---|---|
manifest_obj |
DbtBouncerManifest
|
The DbtBouncerManifest object parsed from |
unit_test |
UnitTests
|
The UnitTests object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
exclude |
Optional[str]
|
Regex pattern to match the unit test path (i.e the .yml file where the unit test is configured). Unit test paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the unit test path (i.e the .yml file where the unit test is configured). Only unit test paths that match the pattern will be checked. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):