2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, pythonOlder
|
|
|
|
, isPy3k
|
2020-08-20 17:08:02 +00:00
|
|
|
, decorator
|
2020-09-25 04:45:31 +00:00
|
|
|
, http-parser
|
2022-05-18 14:49:53 +00:00
|
|
|
, python-magic
|
2021-02-05 17:12:51 +00:00
|
|
|
, urllib3
|
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-mock
|
|
|
|
, aiohttp
|
2022-09-30 11:47:45 +00:00
|
|
|
, fastapi
|
2021-02-05 17:12:51 +00:00
|
|
|
, gevent
|
2022-09-30 11:47:45 +00:00
|
|
|
, httpx
|
2021-02-05 17:12:51 +00:00
|
|
|
, redis
|
|
|
|
, requests
|
|
|
|
, sure
|
2021-03-09 03:18:52 +00:00
|
|
|
, pook
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "mocket";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "3.10.9";
|
2021-03-09 03:18:52 +00:00
|
|
|
disabled = !isPy3k;
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-01-20 10:41:00 +00:00
|
|
|
sha256 = "sha256-fAVw5WvpJOITQWqA8Y6Xi7QbaunZ1WGXxAuUMXbh+Aw=";
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
decorator
|
2020-09-25 04:45:31 +00:00
|
|
|
http-parser
|
2022-05-18 14:49:53 +00:00
|
|
|
python-magic
|
2020-08-20 17:08:02 +00:00
|
|
|
urllib3
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
pytestCheckHook
|
|
|
|
pytest-mock
|
|
|
|
aiohttp
|
2022-09-30 11:47:45 +00:00
|
|
|
fastapi
|
2021-02-05 17:12:51 +00:00
|
|
|
gevent
|
2022-09-30 11:47:45 +00:00
|
|
|
httpx
|
2021-02-05 17:12:51 +00:00
|
|
|
redis
|
|
|
|
requests
|
|
|
|
sure
|
2021-03-09 03:18:52 +00:00
|
|
|
pook
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
# skip http tests
|
|
|
|
SKIP_TRUE_HTTP = true;
|
2021-02-05 17:12:51 +00:00
|
|
|
pytestFlagsArray = [
|
2021-03-09 03:18:52 +00:00
|
|
|
# Requires a live Redis instance
|
|
|
|
"--ignore=tests/main/test_redis.py"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
2021-03-09 03:18:52 +00:00
|
|
|
# Uses IsolatedAsyncioTestCase which is only available >= 3.8
|
2021-02-05 17:12:51 +00:00
|
|
|
"--ignore=tests/tests38/test_http_aiohttp.py"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# tests that require network access (like DNS lookups)
|
|
|
|
"test_truesendall"
|
|
|
|
"test_truesendall_with_chunk_recording"
|
|
|
|
"test_truesendall_with_gzip_recording"
|
|
|
|
"test_truesendall_with_recording"
|
|
|
|
"test_wrongpath_truesendall"
|
|
|
|
"test_truesendall_with_dump_from_recording"
|
|
|
|
"test_truesendall_with_recording_https"
|
|
|
|
"test_truesendall_after_mocket_session"
|
|
|
|
"test_real_request_session"
|
2021-03-09 03:18:52 +00:00
|
|
|
"test_asyncio_record_replay"
|
2022-10-30 15:09:59 +00:00
|
|
|
"test_gethostbyname"
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "mocket" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A socket mock framework - for all kinds of socket animals, web-clients included";
|
|
|
|
homepage = "https://github.com/mindflayer/python-mocket";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ hexa ];
|
|
|
|
};
|
|
|
|
}
|