1{ lib 2, buildPythonPackage 3, fetchPypi 4, pytestCheckHook 5, python 6, mock 7, setuptools-scm 8}: 9 10buildPythonPackage rec { 11 pname = "pytest-console-scripts"; 12 version = "1.2.1"; 13 14 src = fetchPypi { 15 inherit pname version; 16 sha256 = "c7f258025110f1337c23499c2f6674b873d4adba2438be55895edf01451c5ce3"; 17 }; 18 postPatch = '' 19 # setuptools-scm is pinned to <6 because it dropped Python 3.5 20 # support. That's not something that affects us. 21 substituteInPlace setup.py --replace "'setuptools_scm<6'" "'setuptools_scm'" 22 # Patch the shebang of a script generated during test. 23 substituteInPlace tests/test_run_scripts.py --replace "#!/usr/bin/env python" "#!${python.interpreter}" 24 ''; 25 26 SETUPTOOLS_SCM_PRETEND_VERSION = version; 27 nativeBuildInputs = [ setuptools-scm ]; 28 29 checkInputs = [ mock pytestCheckHook ]; 30 31 meta = with lib; { 32 description = "Pytest plugin for testing console scripts"; 33 longDescription = '' 34 Pytest-console-scripts is a pytest plugin for running python scripts from within tests. 35 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). 36 ''; 37 homepage = "https://github.com/kvas-it/pytest-console-scripts"; 38 license = licenses.mit; 39 maintainers = with maintainers; [ AluisioASG ]; 40 }; 41}