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