Skip to content

Commit

Permalink
add many more package content tests and refactor the implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Jan 26, 2024
1 parent e23e9db commit 8e1f6d8
Show file tree
Hide file tree
Showing 20 changed files with 544 additions and 316 deletions.
8 changes: 4 additions & 4 deletions docs/recipe_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -727,14 +727,14 @@ import bsdiff4
import bspatch4
```

### Check for package-contents
### Check for package contents

Checks if the built package contains the mentioned items. These checks are executed directly at
the end of the build process to make sure that all expected files are present in the package.

```yaml
tests:
- package-contents:
- package_contents:
# checks for the existence of files inside $PREFIX or %PREFIX%
# or, checks that there is at least one file matching the specified `glob`
# pattern inside the prefix
Expand All @@ -761,8 +761,8 @@ tests:
- mamba

# searches for `$PREFIX/include/libmamba/mamba.hpp` on unix, and
# on Windows for `%PREFIX%\Library\include\mamba.hpp`
includes:
# on Windows for `%PREFIX%\Library\include\libmamba\mamba.hpp`
include:
- libmamba/mamba.hpp
```
Expand Down
3 changes: 3 additions & 0 deletions examples/rich/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ requirements:
- typing_extensions >=4.0.0,<5.0.0

tests:
- package_contents:
site_packages:
- rich
- python:
imports:
- rich
Expand Down
7 changes: 7 additions & 0 deletions examples/xtensor/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ requirements:
- xsimd >=8.0.3,<10

tests:
- package_contents:
include:
- xtensor/xarray.hpp
files:
- share/cmake/xtensor/xtensorConfig.cmake
- share/cmake/xtensor/xtensorConfigVersion.cmake

- script:
- if: unix or emscripten
then:
Expand Down
10 changes: 3 additions & 7 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,9 @@ pub async fn run_build(
for test in output.recipe.tests() {
// TODO we could also run each of the (potentially multiple) test scripts and collect the errors
if let TestType::PackageContents(package_contents) = test {
package_test::run_package_content_test(
package_contents,
&paths_json,
&output.build_configuration.target_platform,
)
.await
.into_diagnostic()?;
package_contents
.run_test(&paths_json, &output.build_configuration.target_platform)
.into_diagnostic()?;
}
}

Expand Down
Loading

0 comments on commit 8e1f6d8

Please sign in to comment.