summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/aioswitcher/default.nix
blob: 99388853f391bc722375f8e436d73bd740e1e8f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
  lib,
  aiohttp,
  assertpy,
  buildPythonPackage,
  fetchFromGitHub,
  freezegun,
  poetry-core,
  pycryptodome,
  pytest-asyncio,
  pytest-mockservers,
  pytest-resource-path,
  pytestCheckHook,
  pythonAtLeast,
  pytz,
  time-machine,
}:

buildPythonPackage (finalAttrs: {
  pname = "aioswitcher";
  version = "6.0.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "TomerFi";
    repo = "aioswitcher";
    tag = finalAttrs.version;
    hash = "sha256-6wBeAbBiuAZW9kHq/bKC0FMJxkLxM6RZN7RLwbF1ig4=";
  };

  __darwinAllowLocalNetworking = true;

  build-system = [ poetry-core ];

  pythonRelaxDeps = [ "aiohttp" ];

  dependencies = [
    aiohttp
    pycryptodome
  ];

  preCheck = ''
    export TZ=Asia/Jerusalem
  '';

  nativeCheckInputs = [
    assertpy
    freezegun
    pytest-asyncio
    pytest-mockservers
    pytest-resource-path
    pytestCheckHook
    pytz
    time-machine
  ];

  disabledTests = [
    # AssertionError: Expected <14:00> to be equal to <17:00>, but was not.
    "test_schedule_parser_with_a_weekly_recurring_enabled_schedule_data"
    "test_schedule_parser_with_a_daily_recurring_enabled_schedule_data"
    "test_schedule_parser_with_a_partial_daily_recurring_enabled_schedule_data"
    "test_schedule_parser_with_a_non_recurring_enabled_schedule_data"
  ]
  ++ lib.optionals (pythonAtLeast "3.12") [
    # AssertionError: Expected <'I' format requires 0 <= number <= 4294967295> to be equal to <argument out of range>, but was not.
    "test_minutes_to_hexadecimal_seconds_with_a_negative_value_should_throw_an_error"
    "test_current_timestamp_to_hexadecimal_with_errornous_value_should_throw_an_error"
  ]
  ++ lib.optionals (pythonAtLeast "3.14") [
    # AssertionError: Expected <hour must be in 0..23, not -1> to be equal
    "test_seconds_to_iso_time_with_a_nagative_value_should_throw_an_error"
  ];

  pythonImportsCheck = [ "aioswitcher" ];

  meta = {
    description = "Python module to interact with Switcher water heater";
    homepage = "https://github.com/TomerFi/aioswitcher";
    changelog = "https://github.com/TomerFi/aioswitcher/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ fab ];
  };
})