Skip to content

Commit

Permalink
re-add test for context rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Aug 4, 2024
1 parent 54c7ef1 commit 7909e4f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/__snapshots__/test_jinja.ambr
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# serializer version: 1
# name: test_context_rendering
'''
build:
string: ${{ blas_variant }}${{ hash }}_foo-bla
context:
name: foo
name_version: foo-bla
version: bla
package:
name: foo
version: bla

'''
# ---
# name: test_render_recipe_with_context
'''
about:
Expand Down
11 changes: 11 additions & 0 deletions tests/data/context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
context:
name: "foo"
version: "bla"
name_version: ${{ name }}-${{ version }}

package:
name: ${{ name }}
version: ${{ version }}

build:
string: ${{ blas_variant }}${{ hash }}_${{ name_version }}
11 changes: 11 additions & 0 deletions tests/test_jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ def test_version_to_build_string() -> None:
assert _version_to_build_string("nothing") == "nothing"
some_undefined = _MissingUndefined(name="python")
assert _version_to_build_string(some_undefined) == "python_version_to_build_string"


def test_context_rendering(snapshot) -> None:
recipe = Path("tests/data/context.yaml")
with recipe.open() as f:
recipe_yaml = load_yaml(f)

rendered = render_recipe_with_context(recipe_yaml)
into_yaml = yaml.dump(rendered)

assert into_yaml == snapshot

0 comments on commit 7909e4f

Please sign in to comment.