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.4.0";
14 disabled = pythonOlder "3.6";
15
16 src = fetchFromGitHub {
17 owner = "adamchainz";
18 repo = pname;
19 rev = version;
20 sha256 = "sha256-1k8mGkgJw0MfydJ/Sm8qDvFNaIqoHR1fZkVrXxvc8Zk=";
21 };
22
23 propagatedBuildInputs = [
24 python-dateutil
25 #] ++ lib.optionals (pythonOlder "3.9") [
26 backports-zoneinfo
27 ];
28
29 checkInputs = [
30 pytestCheckHook
31 ];
32
33 disabledTests = lib.optionals (pythonAtLeast "3.9") [
34 # Assertion Errors related to Africa/Addis_Ababa
35 "test_destination_datetime_tzinfo_zoneinfo"
36 "test_destination_datetime_tzinfo_zoneinfo_nested"
37 "test_move_to_datetime_with_tzinfo_zoneinfo"
38 ];
39
40 pythonImportsCheck = [
41 "time_machine"
42 ];
43
44 meta = with lib; {
45 description = "Travel through time in your tests";
46 homepage = "https://github.com/adamchainz/time-machine";
47 license = licenses.mit;
48 maintainers = with maintainers; [ fab ];
49 };
50}