Commit 0090bf42 authored by Jack Maloney's avatar Jack Maloney Committed by Masum Reza
Browse files

nbstripout: fix tests

parent b4cef5f9
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -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 = {