about summary refs log tree commit diff
path: root/pkgs/development/python-modules/sockio/default.nix
blob: 8ce561b781f93601395d32c82761094c87f1bebd (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
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytest-asyncio
, pytestCheckHook
, pythonOlder
}:

buildPythonPackage rec {
  pname = "sockio";
  version = "0.15.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "tiagocoutinho";
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-NSGd7/k1Yr408dipMNBSPRSwQ+wId7VLxgqMM/UmN/Q=";
  };

  postPatch = ''
    substituteInPlace setup.cfg \
      --replace "--cov-config=.coveragerc --cov sockio" "" \
      --replace "--cov-report html --cov-report term" "" \
      --replace "--durations=2 --verbose" ""
  '';

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    pytest-asyncio
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "sockio"
  ];

  disabledTests = [
    # Tests require network access
    "test_open_timeout"
    "test_write_readline_error"
    "test_open_close"
    "test_callbacks"
    "test_coroutine_callbacks"
    "test_error_callback"
    "test_eof_callback"
    "test_write_read"
    "test_write_readline"
    "test_write_readlines"
    "test_writelines_readlines"
    "test_writelines"
    "test_readline"
    "test_readuntil"
    "test_readexactly"
    "test_readlines"
    "test_read"
    "test_readbuffer"
    "test_parallel_rw"
    "test_parallel"
    "test_stream"
    "test_timeout"
    "test_line_stream"
    "test_block_stream"
    "test_socket_for_url"
    "test_root_socket_for_url"
  ];

  disabledTestPaths = [
    # We don't care about Python 2.x
    "tests/test_py2.py"
  ];

  meta = with lib; {
    description = "Implementation of the Modbus protocol";
    homepage = "https://tiagocoutinho.github.io/sockio/";
    license = with licenses; [ gpl3Plus ];
    maintainers = with maintainers; [ fab ];
  };
}