at master 2.0 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 stdenv, 5 fetchPypi, 6 7 # build-system 8 hatchling, 9 10 # dependencies 11 decorator, 12 h11, 13 puremagic, 14 urllib3, 15 16 # optional-dependencies 17 xxhash, 18 pook, 19 20 # tests 21 aiohttp, 22 asgiref, 23 fastapi, 24 gevent, 25 httpx, 26 psutil, 27 pytest-asyncio, 28 pytest-cov-stub, 29 pytestCheckHook, 30 redis, 31 redisTestHook, 32 requests, 33 sure, 34 35}: 36 37buildPythonPackage rec { 38 pname = "mocket"; 39 version = "3.13.11"; 40 pyproject = true; 41 42 src = fetchPypi { 43 inherit pname version; 44 hash = "sha256-kdG2Md90YknRA265u+JjHuiKw/6h1NcdwYOLXy8UF1o="; 45 }; 46 47 build-system = [ hatchling ]; 48 49 dependencies = [ 50 decorator 51 h11 52 puremagic 53 urllib3 54 ]; 55 56 optional-dependencies = { 57 pook = [ pook ]; 58 speedups = [ xxhash ]; 59 }; 60 61 nativeCheckInputs = [ 62 aiohttp 63 asgiref 64 fastapi 65 gevent 66 httpx 67 psutil 68 pytest-asyncio 69 pytest-cov-stub 70 pytestCheckHook 71 redis 72 redisTestHook 73 requests 74 sure 75 ] 76 ++ lib.flatten (lib.attrValues optional-dependencies); 77 78 # Skip http tests, they require network access 79 env.SKIP_TRUE_HTTP = true; 80 81 __darwinAllowLocalNetworking = true; 82 83 disabledTests = [ 84 # tests that require network access (like DNS lookups) 85 "test_truesendall_with_dump_from_recording" 86 "test_aiohttp" 87 "test_asyncio_record_replay" 88 "test_gethostbyname" 89 # httpx read failure 90 "test_no_dangling_fds" 91 ] 92 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 93 # fails on darwin due to upstream bug: https://github.com/mindflayer/python-mocket/issues/287 94 "test_httprettish_httpx_session" 95 ]; 96 97 pythonImportsCheck = [ "mocket" ]; 98 99 meta = with lib; { 100 changelog = "https://github.com/mindflayer/python-mocket/releases/tag/${version}"; 101 description = "Socket mock framework for all kinds of sockets including web-clients"; 102 homepage = "https://github.com/mindflayer/python-mocket"; 103 license = licenses.bsd3; 104 maintainers = [ ]; 105 }; 106}