git.iko.soy/typeable/nixpkgs
on master help sign in
python3Packages.pytest-console-scripts: init at 1.2.0

Thanks to @kvas-it for cutting a release with the patches needed to make tests work.

commit932ec5518e854d4388827ea45f65284766da0317 authorAluísio Augusto Silva Gonçalves <aluisio@aasg.name> dateFri 23 Apr 2021, 16:16 (6 years ago) parent98822ee
2 files changed+43
pkgs/development/python-modules/pytest-console-scripts/default.nix+41 pkgs/top-level/python-packages.nix+2
pkgs/development/python-modules/pytest-console-scripts/default.nixnew file+41
@@ -0,0 +1,41 @@
1+{ lib
2+, buildPythonPackage
3+, fetchPypi
4+, pytestCheckHook
5+, python
6+, mock
7+, setuptools-scm
8+}:
9+
10+buildPythonPackage rec {
11+ pname = "pytest-console-scripts";
12+ version = "1.2.0";
13+
14+ src = fetchPypi {
15+ inherit pname version;
16+ sha256 = "4a2138d7d567bc581fe081b6a5975849a2a36b3925cb0f066d2380103e13741c";
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+}
pkgs/top-level/python-packages.nix+2
@@ -6261,6 +6261,8 @@ in {
62616261
62626262 pytest-click = callPackage ../development/python-modules/pytest-click { };
62636263
6264+ pytest-console-scripts = callPackage ../development/python-modules/pytest-console-scripts { };
6265+
62646266 pytest-cov = self.pytestcov; # self 2021-01-04
62656267 pytestcov = callPackage ../development/python-modules/pytest-cov { };
62666268