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