Skip to content

Commit

Permalink
test: add full test for crates.io source
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhall88 committed Sep 26, 2024
1 parent 78082ee commit f0d24b4
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/test_upstream_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
NPM,
NVIDIA,
AbstractSource,
CratesIO,
Github,
GithubReleases,
PyPI,
Expand Down Expand Up @@ -1719,3 +1720,37 @@ def test_github_releases(tmpdir, url, feedstock_version):
ghr = GithubReleases()
url = ghr.get_url(meta_yaml)
assert VersionOrder(ghr.get_version(url)) > VersionOrder(feedstock_version)


def test_latest_version_cratesio(tmpdir):
name = "wbg-rand"
recipe_path = os.path.join(YAML_PATH, "version_wbg-rand.yaml")
curr_ver = "0.4.0"
ver = "0.4.1"
source = CratesIO()

with open(recipe_path) as fd:
inp = fd.read()

pmy = LazyJson(os.path.join(str(tmpdir), "cf-scripts-test.json"))
with pmy as _pmy:
yml = parse_meta_yaml(inp)
_pmy.update(yml["source"])
_pmy.update(
{
"feedstock_name": name,
"version": curr_ver,
"raw_meta_yaml": inp,
"meta_yaml": yml,
},
)

attempt = get_latest_version(name, pmy, [source], use_container=False)
if ver is None:
assert attempt["new_version"] is not False
assert attempt["new_version"] != curr_ver
assert VersionOrder(attempt["new_version"]) > VersionOrder(curr_ver)
elif ver is False:
assert attempt["new_version"] is ver
else:
assert ver == attempt["new_version"]
37 changes: 37 additions & 0 deletions tests/test_yaml/version_wbg-rand.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package:
name: wbg-rand
version: "0.4.0"

source:
url: https://crates.io/api/v1/crates/wbg-rand/0.4.0/download
fn: "wbg-rand-0.4.0.tar.gz"
sha256: 5505e10cb191f56fed835c35baf4ac97b5466148a13fbcaeb1173198b1a52b4c

build:
number: 0
skip: true # [win]

requirements:
build:
- {{ compiler('rust') }}
- {{ compiler('c') }}
- {{ stdlib("c") }}
- cargo-bundle-licenses

test:
commands:
- echo "This is a placeholder for the test section"

about:
home: https://github.com/alexcrichton/wbg-rand
summary: 'Random numbers for wasm32-unknown-unknown in Rust'
description: |
Implementation of rand for wasm32-unknown-unknown in Rust using #[wasm_bindgen].
license: MIT AND Apache-2.0
license_file:
- LICENSE-MIT
- LICENSE-APACHE

extra:
recipe-maintainers:
- mbhall88

0 comments on commit f0d24b4

Please sign in to comment.