nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchPypi
4, pytestCheckHook
5, python
6, mock
7, setuptools-scm
8, pythonOlder
9}:
10
11buildPythonPackage rec {
12 pname = "pytest-console-scripts";
13 version = "1.3.1";
14 format = "setuptools";
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-XGw9qunPn77Q5lUHISiThgAZPcACpc8bGHJIZEugKFc=";
21 };
22
23 SETUPTOOLS_SCM_PRETEND_VERSION = version;
24
25 nativeBuildInputs = [
26 setuptools-scm
27 ];
28
29 checkInputs = [
30 mock
31 pytestCheckHook
32 ];
33
34 postPatch = ''
35 # Patch the shebang of a script generated during test.
36 substituteInPlace tests/test_run_scripts.py \
37 --replace "#!/usr/bin/env python" "#!${python.interpreter}"
38 '';
39
40 pythonImportsCheck = [
41 "pytest_console_scripts"
42 ];
43
44 meta = with lib; {
45 description = "Pytest plugin for testing console scripts";
46 longDescription = ''
47 Pytest-console-scripts is a pytest plugin for running python scripts from within tests.
48 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).
49 '';
50 homepage = "https://github.com/kvas-it/pytest-console-scripts";
51 license = licenses.mit;
52 maintainers = with maintainers; [ AluisioASG ];
53 };
54}