Skip to content

Commit a026f13

Browse files
chore: testing docs additions (#5221)
Co-authored-by: Themis Valtinos <73662635+themisvaltinos@users.noreply.github.com>
1 parent f9eb71b commit a026f13

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

tests/dbt/test_docs.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from pathlib import Path
2+
import pytest
3+
4+
from sqlmesh.core.config.model import ModelDefaultsConfig
5+
from sqlmesh.dbt.context import DbtContext
6+
from sqlmesh.dbt.manifest import ManifestHelper
7+
from sqlmesh.dbt.profile import Profile
8+
9+
10+
pytestmark = pytest.mark.dbt
11+
12+
13+
@pytest.mark.xdist_group("dbt_manifest")
14+
def test_docs_inline():
15+
project_path = Path("tests/fixtures/dbt/sushi_test")
16+
profile = Profile.load(DbtContext(project_path))
17+
18+
helper = ManifestHelper(
19+
project_path,
20+
project_path,
21+
"sushi",
22+
profile.target,
23+
model_defaults=ModelDefaultsConfig(start="2020-01-01"),
24+
)
25+
# Inline description in yaml
26+
assert helper.models()["waiters"].description == "waiters docs block"
27+
# Docs block from .md file
28+
assert helper.models()["top_waiters"].description == "description of top waiters"

tests/fixtures/dbt/sushi_test/models/schema.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: 2
22

33
models:
44
- name: top_waiters
5+
description: description of top waiters
56
columns:
67
- name: waiter_id
78
data_type: int
@@ -18,6 +19,7 @@ models:
1819
warn_after: {count: 8, period: hour}
1920
error_after: {count: 9, period: hour}
2021
- name: waiters
22+
description: '{{ doc("waiters") }}'
2123
- name: waiter_as_customer_by_day
2224
- name: waiter_revenue_by_day
2325
versions:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% docs waiters %}
2+
waiters docs block
3+
{% enddocs %}
4+

0 commit comments

Comments
 (0)