2021-05-03 20:48:10 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2022-09-30 11:47:45 +00:00
|
|
|
, mock
|
2021-05-03 20:48:10 +00:00
|
|
|
, fetchPypi
|
|
|
|
, pytestCheckHook
|
|
|
|
, python
|
2022-03-05 16:20:37 +00:00
|
|
|
, pythonOlder
|
2022-09-30 11:47:45 +00:00
|
|
|
, setuptools-scm
|
|
|
|
, setuptools
|
2021-05-03 20:48:10 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytest-console-scripts";
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "1.3.1";
|
2022-03-05 16:20:37 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-03-30 09:31:56 +00:00
|
|
|
hash = "sha256-XGw9qunPn77Q5lUHISiThgAZPcACpc8bGHJIZEugKFc=";
|
2021-05-03 20:48:10 +00:00
|
|
|
};
|
2022-03-05 16:20:37 +00:00
|
|
|
|
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools-scm
|
|
|
|
];
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
checkInputs = [
|
|
|
|
mock
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Patch the shebang of a script generated during test.
|
2022-03-05 16:20:37 +00:00
|
|
|
substituteInPlace tests/test_run_scripts.py \
|
|
|
|
--replace "#!/usr/bin/env python" "#!${python.interpreter}"
|
2021-05-03 20:48:10 +00:00
|
|
|
'';
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pytest_console_scripts"
|
|
|
|
];
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
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 = with maintainers; [ AluisioASG ];
|
|
|
|
};
|
|
|
|
}
|