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