File: python-pytest.nix

package info (click to toggle)
confget 5.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 740 kB
  • sloc: python: 1,017; ansic: 893; sh: 770; makefile: 142
file content (21 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
# SPDX-License-Identifier: BSD-2-Clause

{ pkgs ? import <nixpkgs> { }
, py-ver ? 311
}:
let
  python-name = "python${toString py-ver}";
  python = builtins.getAttr python-name pkgs;
  python-with-pytest = python.withPackages (p: with p; [ ddt pyparsing pytest ]);
in
pkgs.mkShell {
  buildInputs = [ python-with-pytest ];

  shellHook = ''
    set -e
    cd python
    env PYTHONPATH="$(pwd)/src" pytest -s unit_tests
    exit
  '';
}