Files
Dom Rodriguez 5c51708c8c buildstream-plugins-community: run the test suite as a NixOS VM test
The upstream pytest suite needs `buildstream` present (including its
shared source-plugin test helpers and templated repo-kind tests) and
needs buildbox-casd's real FUSE-based staging, which needs `/dev/fuse`
and a working mount path that the Nix build sandbox doesn't provide.

Add nixosTests.buildstream-plugins-community and point
passthru.tests.pytest at it instead: programs.fuse.enable gives real
/dev/fuse access, so the suite exercises the actual FUSE-backed
staging path. `buildstream`'s own `bst` entry point bakes its
dependencies' site-packages directories into that script rather than
exposing them under its own site-packages directory, so
`toPythonModule` is used to pull `buildstream` and its dependencies
into a shared environment that `pytest` can import from.

Deselect the handful of tests that reach out to gitlab.com for real
network fetches (bazel/bazel_file manifest downloads, the git-lfs test
repo), since network access isn't available in the test VM either.

Pass `tests` as an explicit path to pytest: buildstream's
sourcetests_collection_hook only pulls in the shared repo-kind tests
from buildstream._testing._sourcetests when no test path is given on
the command line, and those shared tests fail with a stray
PermissionError (pytest-datafiles copies their fixtures from
buildstream's read-only Nix store package data). Giving an explicit
path avoids collecting them at all, rather than deselecting them
individually.

Assisted-by: Claude <noreply@anthropic.com>
2026-10-04 01:24:46 +02:00

63 lines
1.5 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitLab,
gitUpdater,
nixosTests,
setuptools,
setuptools-scm,
# Optional plugin dependencies, matching upstream's pyproject.toml extras.
arpy,
dulwich,
packaging,
requests,
tomlkit,
}:
buildPythonPackage (finalAttrs: {
pname = "buildstream-plugins-community";
version = "2.3.3";
pyproject = true;
src = fetchFromGitLab {
owner = "buildstream";
repo = "buildstream-plugins-community";
tag = finalAttrs.version;
hash = "sha256-Fvm7TKwKmOAiVATJrvvd9I5mpPN+zkCxaMXnoksVrJE=";
};
build-system = [
setuptools
setuptools-scm
];
dependencies = [
arpy
dulwich
packaging
requests
tomlkit
];
# Loaded by `bst` at runtime via pluginbase, so `buildstream` is always
# present when imported; drop it here instead of propagating a second
# `buildstream` closure into consumers that already bundle one.
pythonRemoveDeps = [ "buildstream" ];
pythonImportsCheck = [ "buildstream_plugins_community" ];
passthru = {
updateScript = gitUpdater { };
tests.pytest = nixosTests.buildstream-plugins-community;
};
meta = {
changelog = "https://gitlab.com/BuildStream/buildstream-plugins-community/-/blob/${finalAttrs.src.tag}/NEWS";
description = "BuildStream community plugins";
homepage = "https://gitlab.com/buildstream/buildstream-plugins-community";
platforms = lib.platforms.linux;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ shymega ];
};
})