summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytest-harvest/default.nix
blob: c549153b4e4b835034033371ceb2701db252c4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools-scm,
  pytest,
  decopatch,
  makefun,
  six,
  pytestCheckHook,
  numpy,
  pandas,
  tabulate,
  pytest-cases,
}:

buildPythonPackage rec {
  pname = "pytest-harvest";
  version = "1.10.5";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "smarie";
    repo = "python-pytest-harvest";
    tag = version;
    hash = "sha256-s8QiuUFRTTRhSpLa0DHScKFC9xdu+w2rssWCg8sIjsg=";
  };

  # create file, that is created by setuptools_scm
  # we disable this file creation as it touches internet
  postPatch = ''
    echo "version = '${version}'" > pytest_harvest/_version.py

    substituteInPlace pytest_harvest/tests/test_lazy_and_harvest.py \
      --replace-fail "from distutils.version import LooseVersion" "from packaging.version import parse" \
      --replace-fail "LooseVersion" "parse"
  '';

  nativeBuildInputs = [
    setuptools-scm
  ];

  buildInputs = [ pytest ];

  propagatedBuildInputs = [
    decopatch
    makefun
    six
  ];

  nativeCheckInputs = [
    pytestCheckHook
    numpy
    pandas
    tabulate
    pytest-cases
  ];

  pythonImportsCheck = [ "pytest_harvest" ];

  meta = {
    description = "Store data created during your `pytest` tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes";
    homepage = "https://github.com/smarie/python-pytest-harvest";
    changelog = "https://github.com/smarie/python-pytest-harvest/releases/tag/${version}";
    license = lib.licenses.bsd3;
    maintainers = [ ];
  };
}