about summary refs log tree commit diff
path: root/pkgs/development/python-modules/freezegun/default.nix
blob: b1300b4e1146d7d4c4921dae513cc5409fe69355 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ lib
, buildPythonPackage
, fetchpatch
, fetchPypi
, pytestCheckHook
, python-dateutil
, pythonAtLeast
, pythonOlder
}:

buildPythonPackage rec {
  pname = "freezegun";
  version = "1.2.2";
  format = "setuptools";

  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-zSLRugaUE4RBDNln2KmdWuJEL1ffr+/y/aXejcXAVEY=";
  };

  patches = lib.optionals (pythonAtLeast "3.10") [
    # Staticmethods in 3.10+ are now callable, prevent freezegun to attempt to decorate them
    (fetchpatch {
      url = "https://github.com/spulec/freezegun/pull/397/commits/e63874ce75a74a1159390914045fe8e7955b24c4.patch";
      hash = "sha256-FNABqVN5DFqVUR88lYzwbfsZj3xcB9/MvQtm+I2VjnI=";
    })
  ];

  propagatedBuildInputs = [
    python-dateutil
  ];

  checkInputs = [
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "freezegun"
  ];

  meta = with lib; {
    description = "Library that allows your Python tests to travel through time";
    homepage = "https://github.com/spulec/freezegun";
    license = licenses.asl20;
    maintainers = with maintainers; [ fab ];
  };
}