Skip to content

Commit dd086fc

Browse files
committed
test: add proper test pipeline
1 parent f13ec64 commit dd086fc

File tree

8 files changed

+308
-117
lines changed

8 files changed

+308
-117
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ __pycache__/
1313

1414
### Poetry ###
1515
dist/
16+
17+
### Beet ###
18+
.out

examples/sanity_test/beet.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
data_pack:
2+
load: src
3+
overlays:
4+
- formats:
5+
min_inclusive: 48
6+
max_inclusive: 48
7+
directory: overlay_48
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
say I'm here now
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
say I was here first

poetry.lock

Lines changed: 231 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ isort = "^5.10.1"
1717
python-semantic-release = "^9.14.0"
1818
pyright = "^1.1.389"
1919
twine = "^5.1.1"
20+
lectern = "^0.34.0"
21+
pytest-insta = "^0.3.0"
2022

2123
[tool.semantic_release]
2224
branch = "main"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Lectern snapshot
2+
3+
## Data pack
4+
5+
`@data_pack pack.mcmeta`
6+
7+
```json
8+
{
9+
"pack": {
10+
"pack_format": 48,
11+
"description": ""
12+
},
13+
"overlays": {
14+
"entries": [
15+
{
16+
"formats": {
17+
"min_inclusive": 48,
18+
"max_inclusive": 48
19+
},
20+
"directory": "overlay_48"
21+
}
22+
]
23+
}
24+
}
25+
```
26+
27+
### demo
28+
29+
`@function demo:demo`
30+
31+
```mcfunction
32+
say I'm here now
33+
```
34+
35+
## Overlay `overlay_48`
36+
37+
`@overlay overlay_48`
38+
39+
### demo
40+
41+
`@function demo:demo`
42+
43+
```mcfunction
44+
say I was here first
45+
```
46+
47+
`@endoverlay`

tests/test_examples.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import os
2+
from pathlib import Path
3+
4+
import pytest
5+
from beet import ProjectCache, run_beet
6+
from lectern import Document
7+
from pytest_insta import SnapshotFixture
8+
9+
10+
@pytest.mark.parametrize("directory", os.listdir("examples"))
11+
def test_build(snapshot: SnapshotFixture, directory: str, tmp_path: Path):
12+
with run_beet(
13+
directory=f"examples/{directory}",
14+
cache=ProjectCache(tmp_path / ".beet_cache", tmp_path / "generated"),
15+
) as ctx:
16+
assert snapshot("pack.md") == ctx.inject(Document)

0 commit comments

Comments
 (0)