1{
2 lib,
3 assertpy,
4 buildPythonPackage,
5 fetchFromGitHub,
6 poetry-core,
7 pytest-asyncio,
8 pytest-mockservers,
9 pytest-resource-path,
10 pytest-sugar,
11 pytestCheckHook,
12 pythonAtLeast,
13 pythonOlder,
14 time-machine,
15}:
16
17buildPythonPackage rec {
18 pname = "aioswitcher";
19 version = "3.4.2";
20 pyproject = true;
21
22 disabled = pythonOlder "3.9";
23
24 src = fetchFromGitHub {
25 owner = "TomerFi";
26 repo = pname;
27 rev = "refs/tags/${version}";
28 hash = "sha256-UpwIzwOl1yKqK8KxFDXAWoZFkQ+1r1sUcDfx6AxRdNw=";
29 };
30
31 __darwinAllowLocalNetworking = true;
32
33 nativeBuildInputs = [ poetry-core ];
34
35 preCheck = ''
36 export TZ=Asia/Jerusalem
37 '';
38
39 nativeCheckInputs = [
40 assertpy
41 pytest-asyncio
42 pytest-mockservers
43 pytest-resource-path
44 pytest-sugar
45 pytestCheckHook
46 time-machine
47 ];
48
49 disabledTests =
50 [
51 # AssertionError: Expected <14:00> to be equal to <17:00>, but was not.
52 "test_schedule_parser_with_a_weekly_recurring_enabled_schedule_data"
53 "test_schedule_parser_with_a_daily_recurring_enabled_schedule_data"
54 "test_schedule_parser_with_a_partial_daily_recurring_enabled_schedule_data"
55 "test_schedule_parser_with_a_non_recurring_enabled_schedule_data"
56 ]
57 ++ lib.optionals (pythonAtLeast "3.12") [
58 # ssertionError: Expected <'I' format requires 0 <= number <= 4294967295> to be equal to <argument out of range>, but was not.
59 "test_minutes_to_hexadecimal_seconds_with_a_negative_value_should_throw_an_error"
60 "test_current_timestamp_to_hexadecimal_with_errornous_value_should_throw_an_error"
61 ];
62
63 pythonImportsCheck = [ "aioswitcher" ];
64
65 meta = with lib; {
66 description = "Python module to interact with Switcher water heater";
67 homepage = "https://github.com/TomerFi/aioswitcher";
68 changelog = "https://github.com/TomerFi/aioswitcher/releases/tag/${version}";
69 license = with licenses; [ mit ];
70 maintainers = with maintainers; [ fab ];
71 };
72}