python311Packages.mocket: 3.11.1 -> 3.12.0

https://github.com/mindflayer/python-mocket/releases/tag/3.12.0

Test with redis-server on Linux, reorganize dependencies
This commit is contained in:
Martin Weinelt 2023-10-28 21:45:56 +02:00
parent d59ba91d5a
commit eed9ab649a
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 56 additions and 34 deletions

View File

@ -1,37 +1,51 @@
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, stdenv
# build-system
, hatchling
# dependencies
, decorator
, httptools
, python-magic
, urllib3
# optional-dependencies
, xxhash
, pook
# tests
, aiohttp
, asgiref
, buildPythonPackage
, decorator
, fastapi
, fetchPypi
, gevent
, httptools
, httpx
, isPy3k
, pook
, pytest-mock
, pytest-asyncio
, pytestCheckHook
, python-magic
, pythonOlder
, redis
, redis-server
, requests
, sure
, urllib3
}:
buildPythonPackage rec {
pname = "mocket";
version = "3.11.1";
format = "setuptools";
disabled = pythonOlder "3.7";
version = "3.12.0";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-sEPLUN9nod4AKYcoCNQZ4FBblUCLCPV1dFOrNC6xDWo=";
hash = "sha256-brvBWwTWT2F/usVBRr7wz9L0kct4X1Fddl4mu5LUENA=";
};
nativeBuildInputs = [
hatchling
];
propagatedBuildInputs = [
decorator
httptools
@ -43,52 +57,58 @@ buildPythonPackage rec {
pook = [
pook
];
speedups = [
xxhash
];
};
nativeCheckInputs = [
aiohttp
asgiref
fastapi
gevent
httpx
pytest-mock
pytest-asyncio
pytestCheckHook
redis
requests
sure
] ++ passthru.optional-dependencies.pook;
] ++ lib.optionals (pythonOlder "3.12") [
aiohttp
] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
# Skip http tests
SKIP_TRUE_HTTP = true;
preCheck = lib.optionalString stdenv.isLinux ''
${redis-server}/bin/redis-server &
REDIS_PID=$!
'';
disabledTestPaths = [
# Requires a live Redis instance
"tests/main/test_redis.py"
];
postCheck = lib.optionalString stdenv.isLinux ''
kill $REDIS_PID
'';
# Skip http tests, they require network access
env.SKIP_TRUE_HTTP = true;
_darwinAllowLocalNetworking = true;
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"
"test_asyncio_record_replay"
"test_gethostbyname"
];
disabledTestPaths = lib.optionals stdenv.isDarwin [
"tests/main/test_redis.py"
];
pythonImportsCheck = [
"mocket"
];
meta = with lib; {
changelog = "https://github.com/mindflayer/python-mocket/releases/tag/${version}";
description = "A socket mock framework for all kinds of sockets including web-clients";
homepage = "https://github.com/mindflayer/python-mocket";
changelog = "https://github.com/mindflayer/python-mocket/releases/tag/${version}";
license = licenses.bsd3;
maintainers = with maintainers; [ hexa ];
};

View File

@ -6930,7 +6930,9 @@ self: super: with self; {
mobly = callPackage ../development/python-modules/mobly { };
mocket = callPackage ../development/python-modules/mocket { };
mocket = callPackage ../development/python-modules/mocket {
redis-server = pkgs.redis;
};
mock = callPackage ../development/python-modules/mock { };