1{
2 lib,
3 buildPythonPackage,
4 mock,
5 fetchPypi,
6 pytestCheckHook,
7 python,
8 pythonOlder,
9 setuptools-scm,
10 setuptools,
11}:
12
13buildPythonPackage rec {
14 pname = "pytest-console-scripts";
15 version = "1.4.1";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 inherit pname version;
22 hash = "sha256-WoJu2EzAr6IC655EOB19di973ajgwj+feafx9Ez0qJU=";
23 };
24
25 nativeBuildInputs = [ setuptools-scm ];
26
27 propagatedBuildInputs = [ setuptools ];
28
29 nativeCheckInputs = [
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 = [ "pytest_console_scripts" ];
41
42 meta = with lib; {
43 description = "Pytest plugin for testing console scripts";
44 longDescription = ''
45 Pytest-console-scripts is a pytest plugin for running python scripts from within tests.
46 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).
47 '';
48 homepage = "https://github.com/kvas-it/pytest-console-scripts";
49 license = licenses.mit;
50 maintainers = [ ];
51 };
52}