2020-08-17 13:39:58 +01:00
|
|
|
{ lib, buildPythonPackage, fetchPypi, pythonOlder, isPy27
|
|
|
|
, decorator
|
2020-09-22 01:39:57 +01:00
|
|
|
, http-parser
|
2020-08-17 13:39:58 +01:00
|
|
|
, importlib-metadata
|
|
|
|
, python
|
|
|
|
, python_magic
|
|
|
|
, six
|
2021-01-16 12:03:51 +00:00
|
|
|
, urllib3
|
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-mock
|
|
|
|
, aiohttp
|
|
|
|
, gevent
|
|
|
|
, redis
|
|
|
|
, requests
|
|
|
|
, sure
|
|
|
|
}:
|
2020-08-17 13:39:58 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "mocket";
|
2021-01-16 12:03:51 +00:00
|
|
|
version = "3.9.39";
|
2020-08-17 13:39:58 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-01-16 12:03:51 +00:00
|
|
|
sha256 = "1mbcgfy1vfwwzn54vkq8xmfzdyc28brfpqk4d55r3a6abwwsn6a4";
|
2020-08-17 13:39:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
decorator
|
2020-09-22 01:39:57 +01:00
|
|
|
http-parser
|
2020-08-17 13:39:58 +01:00
|
|
|
python_magic
|
|
|
|
urllib3
|
|
|
|
six
|
|
|
|
] ++ lib.optionals (isPy27) [ six ];
|
|
|
|
|
2021-01-16 12:03:51 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
pytest-mock
|
|
|
|
aiohttp
|
|
|
|
gevent
|
|
|
|
redis
|
|
|
|
requests
|
|
|
|
sure
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
"--ignore=tests/main/test_pook.py" # pook is not packaged
|
|
|
|
"--ignore=tests/main/test_redis.py" # requires a live redis instance
|
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
|
|
|
# uses IsolatedAsyncioTestCase which is only available >= 3.8
|
|
|
|
"--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"
|
|
|
|
];
|
2020-08-17 13:39:58 +01: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 ];
|
|
|
|
};
|
|
|
|
}
|