nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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.5";
23 disabled = !isPy3k;
24
25 src = fetchPypi {
26 inherit pname version;
27 sha256 = "sha256-rF6ol5T6wH0nNmaP+lHQL8H+XZz1kl7OEe7NNO4MCtw=";
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 # skip http tests
49 SKIP_TRUE_HTTP = true;
50 pytestFlagsArray = [
51 # Requires a live Redis instance
52 "--ignore=tests/main/test_redis.py"
53 ] ++ lib.optionals (pythonOlder "3.8") [
54 # Uses IsolatedAsyncioTestCase which is only available >= 3.8
55 "--ignore=tests/tests38/test_http_aiohttp.py"
56 ];
57
58 disabledTests = [
59 # tests that require network access (like DNS lookups)
60 "test_truesendall"
61 "test_truesendall_with_chunk_recording"
62 "test_truesendall_with_gzip_recording"
63 "test_truesendall_with_recording"
64 "test_wrongpath_truesendall"
65 "test_truesendall_with_dump_from_recording"
66 "test_truesendall_with_recording_https"
67 "test_truesendall_after_mocket_session"
68 "test_real_request_session"
69 "test_asyncio_record_replay"
70 ];
71
72 pythonImportsCheck = [ "mocket" ];
73
74 meta = with lib; {
75 description = "A socket mock framework - for all kinds of socket animals, web-clients included";
76 homepage = "https://github.com/mindflayer/python-mocket";
77 license = licenses.bsd3;
78 maintainers = with maintainers; [ hexa ];
79 };
80}