Skip to content

Commit b3c03db

Browse files
committed
buildstream-plugins-community: fix buildstream test interpreter mismatch and enable tests
The `buildstream` nativeCheckInput is a top-level (non-python-scoped) package fixed to the default interpreter, so it failed with `ModuleNotFoundError: No module named 'buildstream'` when building for another interpreter. It's now rebuilt against `python.pkgs` so it matches whichever interpreter is building this package. With that fixed, the shared repo-kind tests pulled in from `buildstream._testing._sourcetests` fail with `PermissionError`, since `pytest-datafiles` preserves the read-only permission bits of `buildstream`'s installed (Nix-store-read-only) package data when copying fixtures, and the shared test helpers then try to write into that copy. This is the same upstream bug as apache/buildstream#2196 (see also PR NixOS#510073 for the same fix in the sibling `buildstream-plugins` package); those specific tests are disabled here in the meantime. Assisted-by: Claude <[email protected]>
1 parent b1eba7b commit b3c03db

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

  • pkgs/development/python-modules/buildstream-plugins-community

‎pkgs/development/python-modules/buildstream-plugins-community/default.nix‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
lib,
3+
python,
34
buildPythonPackage,
45
fetchFromGitLab,
56
gitUpdater,
@@ -62,7 +63,12 @@ buildPythonPackage (finalAttrs: {
6263
# always has `buildstream` in its environment when imported; it is not
6364
# declared as a `dependencies` entry here to avoid pulling a second
6465
# `buildstream` closure into consumers that already bundle it.
65-
buildstream
66+
#
67+
# `buildstream` is a top-level (non-python-scoped) package built against
68+
# the default interpreter, so it must be rebuilt against `python.pkgs`
69+
# here to stay import-compatible when this is built for another
70+
# interpreter, e.g. `python313Packages.buildstream-plugins-community`.
71+
(buildstream.override { python3Packages = python.pkgs; })
6672
buildbox
6773
gitMinimal
6874
ostree
@@ -93,6 +99,33 @@ buildPythonPackage (finalAttrs: {
9399
"--deselect=tests/sources/git_tag.py::test_gitlfs_notset"
94100
];
95101

102+
# These are the shared repo-kind tests that `tests/conftest.py` pulls in
103+
# from `buildstream._testing._sourcetests` via `sourcetests_collection_hook`.
104+
# Their datafiles fixtures are project templates bundled inside the
105+
# already-installed (and therefore read-only, per the Nix store)
106+
# `buildstream` package; `pytest-datafiles` copies them with
107+
# `shutil.copytree`/`copy`, which preserve the source's (missing) write
108+
# bit, so code that writes into the copy (e.g. `add_plugins_conf`'s atomic
109+
# yaml dump) fails with `PermissionError`.
110+
disabledTestPaths = [
111+
"build_checkout.py::test_fetch_build_checkout"
112+
"fetch.py::test_fetch"
113+
"fetch.py::test_fetch_cross_junction"
114+
"mirror.py::test_mirror_fetch"
115+
"mirror.py::test_mirror_fetch_upstream_absent"
116+
"mirror.py::test_mirror_from_includes"
117+
"mirror.py::test_mirror_track_upstream_present"
118+
"mirror.py::test_mirror_track_upstream_absent"
119+
"track.py::test_track"
120+
"track.py::test_track_recurse"
121+
"track.py::test_track_recurse_except"
122+
"track.py::test_cross_junction"
123+
"track.py::test_track_include"
124+
"track.py::test_track_include_junction"
125+
"track.py::test_track_junction_included"
126+
"workspace.py::test_open"
127+
];
128+
96129
passthru.updateScript = gitUpdater { };
97130

98131
meta = {

0 commit comments

Comments
 (0)