1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonAtLeast
5, pythonOlder
6, backports-zoneinfo
7, python-dateutil
8, pytestCheckHook
9}:
10
11buildPythonPackage rec {
12 pname = "time-machine";
13 version = "2.8.2";
14 format = "setuptools";
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchFromGitHub {
19 owner = "adamchainz";
20 repo = pname;
21 rev = version;
22 sha256 = "sha256-EFlvO9QlOP351kZAFQ+hwghL+7m+Cin/OyLV3NX+y8E=";
23 };
24
25 propagatedBuildInputs = [
26 python-dateutil
27 ] ++ lib.optionals (pythonOlder "3.9") [
28 backports-zoneinfo
29 ];
30
31 checkInputs = [
32 pytestCheckHook
33 ];
34
35 disabledTests = lib.optionals (pythonAtLeast "3.9") [
36 # Assertion Errors related to Africa/Addis_Ababa
37 "test_destination_datetime_tzinfo_zoneinfo_nested"
38 "test_destination_datetime_tzinfo_zoneinfo_no_orig_tz"
39 "test_destination_datetime_tzinfo_zoneinfo"
40 "test_move_to_datetime_with_tzinfo_zoneinfo"
41 ];
42
43 pythonImportsCheck = [
44 "time_machine"
45 ];
46
47 meta = with lib; {
48 description = "Travel through time in your tests";
49 homepage = "https://github.com/adamchainz/time-machine";
50 license = licenses.mit;
51 maintainers = with maintainers; [ fab ];
52 };
53}