1{ lib
2, buildPythonPackage
3, fetchPypi
4, six
5, traceback2
6, pythonAtLeast
7}:
8
9buildPythonPackage rec {
10 version = "1.1.0";
11 pname = "unittest2";
12
13 src = fetchPypi {
14 inherit pname version;
15 sha256 = "0y855kmx7a8rnf81d3lh5lyxai1908xjp0laf4glwa4c8472m212";
16 };
17
18 patches = lib.optionals (pythonAtLeast "3.7") [
19 ./collections-compat.patch
20 ];
21
22 propagatedBuildInputs = [ six traceback2 ];
23
24 # 1.0.0 and up create a circle dependency with traceback2/pbr
25 doCheck = false;
26
27 postPatch = ''
28 # argparse is needed for python < 2.7, which we do not support anymore.
29 substituteInPlace setup.py --replace "argparse" ""
30
31 # fixes a transient error when collecting tests, see https://bugs.launchpad.net/python-neutronclient/+bug/1508547
32 sed -i '510i\ return None, False' unittest2/loader.py
33 # https://github.com/pypa/packaging/pull/36
34 sed -i 's/version=VERSION/version=str(VERSION)/' setup.py
35 '';
36
37 meta = with lib; {
38 description = "A backport of the new features added to the unittest testing framework";
39 homepage = "https://pypi.org/project/unittest2/";
40 license = licenses.bsd0;
41 };
42}