1{ lib
2, buildPythonPackage
3, fetchpatch
4, fetchPypi
5, pytestCheckHook
6, python-dateutil
7, pythonAtLeast
8, pythonOlder
9}:
10
11buildPythonPackage rec {
12 pname = "freezegun";
13 version = "1.2.2";
14 format = "setuptools";
15
16 disabled = pythonOlder "3.6";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-zSLRugaUE4RBDNln2KmdWuJEL1ffr+/y/aXejcXAVEY=";
21 };
22
23 patches = lib.optionals (pythonAtLeast "3.10") [
24 # Staticmethods in 3.10+ are now callable, prevent freezegun to attempt to decorate them
25 (fetchpatch {
26 url = "https://github.com/spulec/freezegun/pull/397/commits/e63874ce75a74a1159390914045fe8e7955b24c4.patch";
27 hash = "sha256-FNABqVN5DFqVUR88lYzwbfsZj3xcB9/MvQtm+I2VjnI=";
28 })
29 ];
30
31 propagatedBuildInputs = [
32 python-dateutil
33 ];
34
35 nativeCheckInputs = [
36 pytestCheckHook
37 ];
38
39 pythonImportsCheck = [
40 "freezegun"
41 ];
42
43 meta = with lib; {
44 description = "Library that allows your Python tests to travel through time";
45 homepage = "https://github.com/spulec/freezegun";
46 license = licenses.asl20;
47 maintainers = with maintainers; [ fab ];
48 };
49}