summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytest-console-scripts/default.nix
blob: e3f63c4686f04c0d839f4356328e8b75dc3d5f50 (about) (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
{
  lib,
  buildPythonPackage,
  mock,
  fetchPypi,
  pytestCheckHook,
  python,
  pythonOlder,
  setuptools-scm,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pytest-console-scripts";
  version = "1.4.1";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-WoJu2EzAr6IC655EOB19di973ajgwj+feafx9Ez0qJU=";
  };

  nativeBuildInputs = [ setuptools-scm ];

  propagatedBuildInputs = [ setuptools ];

  nativeCheckInputs = [
    mock
    pytestCheckHook
  ];

  postPatch = ''
    # Patch the shebang of a script generated during test.
    substituteInPlace tests/test_run_scripts.py \
      --replace "#!/usr/bin/env python" "#!${python.interpreter}"
  '';

  pythonImportsCheck = [ "pytest_console_scripts" ];

  meta = with lib; {
    description = "Pytest plugin for testing console scripts";
    longDescription = ''
      Pytest-console-scripts is a pytest plugin for running python scripts from within tests.
      It's quite similar to subprocess.run(), but it also has an in-process mode, where the scripts are executed by the interpreter that's running pytest (using some amount of sandboxing).
    '';
    homepage = "https://github.com/kvas-it/pytest-console-scripts";
    license = licenses.mit;
    maintainers = [ ];
  };
}