1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, isPy3k
6, decorator
7, http-parser
8, python-magic
9, urllib3
10, pytestCheckHook
11, pytest-mock
12, aiohttp
13, fastapi
14, gevent
15, httpx
16, redis
17, requests
18, sure
19, pook
20}:
21
22buildPythonPackage rec {
23 pname = "mocket";
24 version = "3.10.8";
25 disabled = !isPy3k;
26
27 src = fetchPypi {
28 inherit pname version;
29 sha256 = "sha256-aiofKFE9CPLMVJm+IT6VmtJSsVuH7ucpv5Kp1w7d2FE=";
30 };
31
32 propagatedBuildInputs = [
33 decorator
34 http-parser
35 python-magic
36 urllib3
37 ];
38
39 checkInputs = [
40 pytestCheckHook
41 pytest-mock
42 aiohttp
43 fastapi
44 gevent
45 httpx
46 redis
47 requests
48 sure
49 pook
50 ];
51
52 # skip http tests
53 SKIP_TRUE_HTTP = true;
54 pytestFlagsArray = [
55 # Requires a live Redis instance
56 "--ignore=tests/main/test_redis.py"
57 ] ++ lib.optionals (pythonOlder "3.8") [
58 # Uses IsolatedAsyncioTestCase which is only available >= 3.8
59 "--ignore=tests/tests38/test_http_aiohttp.py"
60 ];
61
62 disabledTests = [
63 # tests that require network access (like DNS lookups)
64 "test_truesendall"
65 "test_truesendall_with_chunk_recording"
66 "test_truesendall_with_gzip_recording"
67 "test_truesendall_with_recording"
68 "test_wrongpath_truesendall"
69 "test_truesendall_with_dump_from_recording"
70 "test_truesendall_with_recording_https"
71 "test_truesendall_after_mocket_session"
72 "test_real_request_session"
73 "test_asyncio_record_replay"
74 "test_gethostbyname"
75 ];
76
77 pythonImportsCheck = [ "mocket" ];
78
79 meta = with lib; {
80 description = "A socket mock framework - for all kinds of socket animals, web-clients included";
81 homepage = "https://github.com/mindflayer/python-mocket";
82 license = licenses.bsd3;
83 maintainers = with maintainers; [ hexa ];
84 };
85}