Skip to content

Commit

Permalink
add test for stdlib jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari authored and isuruf committed Sep 24, 2023
1 parent 8a9c195 commit 8c714c8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
c_stdlib: # [unix]
- sysroot # [linux]
- macosx_deployment_target # [osx]
c_stdlib_version: # [unix]
- 2.12 # [linux64]
- 2.17 # [aarch64 or ppc64le]
- 10.13 # [osx and x86_64]
- 11.0 # [osx and arm64]
9 changes: 9 additions & 0 deletions tests/test-recipes/metadata/_stdlib_jinja2/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package:
name: stdlib-test
version: 1.0

requirements:
host:
- {{ stdlib('c') }}
# - {{ stdlib('cxx') }}
# - {{ stdlib('fortran') }}
25 changes: 25 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,31 @@ def test_compiler_metadata_cross_compiler():
)


@pytest.mark.parametrize(
"platform,arch,stdlibs",
[
("linux", "64", {"sysroot_linux-64 2.12"}),
("linux", "aarch64", {"sysroot_linux-64 2.17"}),
("osx", "64", {"macosx_deployment_target_osx-64 10.13"}),
("osx", "arm64", {"macosx_deployment_target_osx-arm64 11.0"}),
],
)
def test_native_stdlib_metadata(
platform: str, arch: str, stdlibs: set[str], testing_config
):
testing_config.platform = platform
metadata = api.render(
os.path.join(metadata_dir, "_stdlib_jinja2"),
config=testing_config,
variants={"target_platform": f"{platform}-{arch}"},
permit_unsatisfiable_variants=True,
finalize=False,
bypass_env_check=True,
python="3.11", # irrelevant
)[0][0]
assert stdlibs <= set(metadata.meta["requirements"]["host"])


def test_hash_build_id(testing_metadata):
testing_metadata.config.variant["zlib"] = "1.2"
testing_metadata.meta["requirements"]["host"] = ["zlib"]
Expand Down

0 comments on commit 8c714c8

Please sign in to comment.