about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/mocket/default.nix
blob: ff8d2856cc991471c45ecc52ddba3c1a596aa6de (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
{ lib
, aiohttp
, asgiref
, buildPythonPackage
, decorator
, fastapi
, fetchPypi
, gevent
, httptools
, httpx
, isPy3k
, pook
, pytest-mock
, pytestCheckHook
, python-magic
, pythonOlder
, redis
, requests
, sure
, urllib3
}:

buildPythonPackage rec {
  pname = "mocket";
  version = "3.11.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-OIdLP3hHnPZ9MqrHt6G5t2SSO342+jTACgzxM6RjVYM=";
  };

  propagatedBuildInputs = [
    decorator
    httptools
    python-magic
    urllib3
  ];

  passthru.optional-dependencies = {
    pook = [
      pook
    ];
  };

  nativeCheckInputs = [
    aiohttp
    asgiref
    fastapi
    gevent
    httpx
    pytest-mock
    pytestCheckHook
    redis
    requests
    sure
  ] ++ passthru.optional-dependencies.pook;

  # Skip http tests
  SKIP_TRUE_HTTP = true;

  disabledTestPaths = [
    # Requires a live Redis instance
    "tests/main/test_redis.py"
  ];

  disabledTests = [
    # tests that require network access (like DNS lookups)
    "test_truesendall"
    "test_truesendall_with_chunk_recording"
    "test_truesendall_with_gzip_recording"
    "test_truesendall_with_recording"
    "test_wrongpath_truesendall"
    "test_truesendall_with_dump_from_recording"
    "test_truesendall_with_recording_https"
    "test_truesendall_after_mocket_session"
    "test_real_request_session"
    "test_asyncio_record_replay"
    "test_gethostbyname"
  ];

  pythonImportsCheck = [
    "mocket"
  ];

  meta = with lib; {
    description = "A socket mock framework for all kinds of sockets including web-clients";
    homepage = "https://github.com/mindflayer/python-mocket";
    changelog = "https://github.com/mindflayer/python-mocket/releases/tag/${version}";
    license = licenses.bsd3;
    maintainers = with maintainers; [ hexa ];
  };
}