python3Packages.wgpu-py: combine passthru tests into one installCheckPhase
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
trio,
|
||||
|
||||
# passthru
|
||||
wgpu-py,
|
||||
testers,
|
||||
wgpu-py,
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
pname = "wgpu-py";
|
||||
@@ -103,62 +103,26 @@ buildPythonPackage rec {
|
||||
trio
|
||||
];
|
||||
|
||||
# Tests break due in Linux CI due to wgpu being unable to find any adapters.
|
||||
# Tests break in Linux CI due to wgpu being unable to find any adapters.
|
||||
# Ordinarily, this would be fixed in an approach similar to `pkgs/by-name/wg/wgpu-native/examples.nix`'s
|
||||
# usage of `runtimeInputs` and `makeWrapperArgs`.
|
||||
# Unfortunately, as this is a Python module without a `mainProgram`, `makeWrapperArgs` will not apply here,
|
||||
# as there is no "script" to wrap.
|
||||
#
|
||||
# In addition thereto, the structure of the tests in `wgpu-py` is unconventional, spread in separate folders
|
||||
# all in the repository's root, which causes `pytestCheckHook` to fail for Darwin platforms too.
|
||||
# As such, we delegate testing to `passthru`.
|
||||
doCheck = false;
|
||||
doCheck = stdenv.hostPlatform.isDarwin;
|
||||
|
||||
passthru = {
|
||||
tests =
|
||||
{
|
||||
version = testers.testVersion {
|
||||
package = wgpu-py;
|
||||
command = "python3 -c 'import wgpu; print(wgpu.__version__)'";
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs stdenv.buildPlatform.isDarwin {
|
||||
tests = testers.runCommand {
|
||||
name = "tests";
|
||||
script = ''
|
||||
WGPU_LIB_PATH=${wgpu-native}/lib/libwgpu_native${stdenv.hostPlatform.extensions.library} \
|
||||
pytest -v ${wgpu-py.src}/tests
|
||||
'';
|
||||
nativeBuildInputs = [ wgpu-py ] ++ nativeCheckInputs;
|
||||
};
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
|
||||
examples = testers.runCommand {
|
||||
name = "examples";
|
||||
script = ''
|
||||
WGPU_LIB_PATH=${wgpu-native}/lib/libwgpu_native${stdenv.hostPlatform.extensions.library} \
|
||||
pytest -v ${wgpu-py.src}/examples
|
||||
'';
|
||||
nativeBuildInputs = [ wgpu-py ] ++ nativeCheckInputs;
|
||||
};
|
||||
for suite in tests examples codegen tests_mem; do
|
||||
pytest -v $suite
|
||||
done
|
||||
|
||||
codegen = testers.runCommand {
|
||||
name = "codegen";
|
||||
script = ''
|
||||
WGPU_LIB_PATH=${wgpu-native}/lib/libwgpu_native${stdenv.hostPlatform.extensions.library} \
|
||||
pytest -v ${wgpu-py.src}/codegen
|
||||
'';
|
||||
nativeBuildInputs = [ wgpu-py ] ++ nativeCheckInputs;
|
||||
};
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
tests_mem = testers.runCommand {
|
||||
name = "tests_mem";
|
||||
script = ''
|
||||
WGPU_LIB_PATH=${wgpu-native}/lib/libwgpu_native${stdenv.hostPlatform.extensions.library} \
|
||||
pytest -v ${wgpu-py.src}/tests_mem
|
||||
'';
|
||||
nativeBuildInputs = [ wgpu-py ] ++ nativeCheckInputs;
|
||||
};
|
||||
};
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = wgpu-py;
|
||||
command = "python3 -c 'import wgpu; print(wgpu.__version__)'";
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
Reference in New Issue
Block a user