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