about summary refs log tree commit diff
path: root/pkgs/development/python-modules/aiocoap/default.nix
blob: af2b220a21c2bc64ff415d335a47676d1f6bc2fe (plain) (blame)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonAtLeast
, pythonOlder

# build-system
, setuptools

# optionals
, cbor2
, cbor-diag
, cryptography
, filelock
, ge25519
, dtlssocket
, websockets
, termcolor
, pygments

# tests
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "aiocoap";
  version = "0.4.7";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "chrysn";
    repo = pname;
    rev = "refs/tags/${version}";
    hash = "sha256-4iwoPfmIwk+PlWUp60aqA5qZgzyj34pnZHf9uH5UhnY=";
  };

  nativeBuildInputs = [
    setuptools
  ];

  passthru.optional-dependencies = {
    oscore = [
      cbor2
      cryptography
      filelock
      ge25519
    ];
    tinydtls = [
      dtlssocket
    ];
    ws = [
      websockets
    ];
    prettyprint = [
      termcolor
      cbor2
      pygments
      cbor-diag
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pytestFlagsArray = lib.optionals (pythonAtLeast "3.12") [
    # https://github.com/chrysn/aiocoap/issues/339
    "--deselect=tests/test_server.py::TestServerTCP::test_big_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_empty_accept"
    "--deselect=tests/test_server.py::TestServerTCP::test_error_resources"
    "--deselect=tests/test_server.py::TestServerTCP::test_fast_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_js_accept"
    "--deselect=tests/test_server.py::TestServerTCP::test_manualbig_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_nonexisting_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_replacing_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_root_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_slow_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_slowbig_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_spurious_resource"
    "--deselect=tests/test_server.py::TestServerTCP::test_unacceptable_accept"
  ];

  disabledTestPaths = [
    # Don't test the plugins
    "tests/test_tls.py"
    "tests/test_reverseproxy.py"
    "tests/test_oscore_plugtest.py"
  ];

  disabledTests = [
    # Communication is not properly mocked
    "test_uri_parser"
  ];

  pythonImportsCheck = [
    "aiocoap"
  ];

  meta = with lib; {
    description = "Python CoAP library";
    homepage = "https://aiocoap.readthedocs.io/";
    changelog = "https://github.com/chrysn/aiocoap/blob/${version}/NEWS";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ fab ];
  };
}