nbstripout: fix tests

This commit is contained in:
Jack Maloney
2025-03-19 09:25:57 +05:30
committed by Masum Reza
parent b4cef5f939
commit 0090bf428c
@@ -2,6 +2,7 @@
lib,
python3,
fetchPypi,
fetchFromGitHub,
coreutils,
gitMinimal,
mercurial,
@@ -16,11 +17,12 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-6qyLa05yno3+Hl3ywPi6RKvFoXplRI8EgBQfgL4jC7E=";
};
# for some reason, darwin uses /bin/sh echo native instead of echo binary, so
# force using the echo binary
postPatch = ''
substituteInPlace tests/test-git.t --replace "echo" "${coreutils}/bin/echo"
'';
testAssets = fetchFromGitHub {
owner = "kynan";
repo = "nbstripout";
rev = "${version}";
hash = "sha256-OSJLrWkYQIhcdyofS3Bo39ppsU6K3A4546UKB8Q1GGg=";
};
propagatedBuildInputs = with python3.pkgs; [
nbformat
@@ -33,14 +35,21 @@ python3.pkgs.buildPythonApplication rec {
mercurial
]
++ (with python3.pkgs; [
pytest-cram
pytestCheckHook
]);
checkInputs = [
testAssets
];
preCheck = ''
export HOME=$(mktemp -d)
export PATH=$out/bin:$PATH
git config --global init.defaultBranch main
cp -r --no-preserve=mode,ownership ${testAssets}/tests/e2e_notebooks $TMPDIR/e2e_notebooks
chmod -R +w $TMPDIR/e2e_notebooks
substituteInPlace tests/test_end_to_end.py --replace "tests/e2e_notebooks" "$TMPDIR/e2e_notebooks"
'';
meta = {