1{ lib
2, aiohttp
3, asgiref
4, buildPythonPackage
5, decorator
6, fastapi
7, fetchPypi
8, gevent
9, httptools
10, httpx
11, isPy3k
12, pook
13, pytest-mock
14, pytestCheckHook
15, python-magic
16, pythonOlder
17, redis
18, requests
19, sure
20, urllib3
21}:
22
23buildPythonPackage rec {
24 pname = "mocket";
25 version = "3.11.0";
26 format = "setuptools";
27
28 disabled = pythonOlder "3.7";
29
30 src = fetchPypi {
31 inherit pname version;
32 hash = "sha256-OIdLP3hHnPZ9MqrHt6G5t2SSO342+jTACgzxM6RjVYM=";
33 };
34
35 propagatedBuildInputs = [
36 decorator
37 httptools
38 python-magic
39 urllib3
40 ];
41
42 passthru.optional-dependencies = {
43 pook = [
44 pook
45 ];
46 };
47
48 nativeCheckInputs = [
49 aiohttp
50 asgiref
51 fastapi
52 gevent
53 httpx
54 pytest-mock
55 pytestCheckHook
56 redis
57 requests
58 sure
59 ] ++ passthru.optional-dependencies.pook;
60
61 # Skip http tests
62 SKIP_TRUE_HTTP = true;
63
64 disabledTestPaths = [
65 # Requires a live Redis instance
66 "tests/main/test_redis.py"
67 ];
68
69 disabledTests = [
70 # tests that require network access (like DNS lookups)
71 "test_truesendall"
72 "test_truesendall_with_chunk_recording"
73 "test_truesendall_with_gzip_recording"
74 "test_truesendall_with_recording"
75 "test_wrongpath_truesendall"
76 "test_truesendall_with_dump_from_recording"
77 "test_truesendall_with_recording_https"
78 "test_truesendall_after_mocket_session"
79 "test_real_request_session"
80 "test_asyncio_record_replay"
81 "test_gethostbyname"
82 ];
83
84 pythonImportsCheck = [
85 "mocket"
86 ];
87
88 meta = with lib; {
89 description = "A socket mock framework for all kinds of sockets including web-clients";
90 homepage = "https://github.com/mindflayer/python-mocket";
91 changelog = "https://github.com/mindflayer/python-mocket/releases/tag/${version}";
92 license = licenses.bsd3;
93 maintainers = with maintainers; [ hexa ];
94 };
95}