Merge pull request #174716 from mweinelt/sanic

This commit is contained in:
Martin Weinelt 2022-05-26 19:32:38 +02:00 committed by GitHub
commit 6d40b80603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 63 deletions

View File

@ -6,6 +6,7 @@
, certifi
, ecs-logging
, fetchFromGitHub
, fetchpatch
, httpx
, jinja2
, jsonschema
@ -40,6 +41,14 @@ buildPythonPackage rec {
sha256 = "sha256-IaCl39rhsFLQwvQdPcqKruV/Mo3f7WH91UVgMG/cnOc=";
};
patches = [
(fetchpatch {
# fix tests with sanic>=22.3.0
url = "https://github.com/elastic/apm-agent-python/commit/114ee6ca998b4d6a5cb075a289af39cb963cf08a.patch";
hash = "sha256-M6yEHjThKDCRQOmR0L94KEt8tUun1tPRULI6PNIlE/8=";
})
];
propagatedBuildInputs = [
aiohttp
blinker

View File

@ -25,6 +25,11 @@ buildPythonPackage rec {
sanic-testing
];
disabledTests = [
# incompatible with sanic>=22.3.0
"test_login_required"
];
postPatch = ''
# Support for httpx>=0.20.0
substituteInPlace tests/test_auth.py \

View File

@ -7,13 +7,13 @@
buildPythonPackage rec {
pname = "sanic-routing";
version = "0.7.2";
version = "22.3.0";
src = fetchFromGitHub {
owner = "sanic-org";
repo = "sanic-routing";
rev = "v${version}";
hash = "sha256-MN6A8CtDVxj34eehr3UIwCT09VOfcruVX+/iImr1MgY=";
hash = "sha256-dX+uxrVjtPxX0ba3WUE/JKgj0PZzvFdKr/lXQgASN6Y=";
};
checkInputs = [ pytestCheckHook pytest-asyncio ];

View File

@ -9,13 +9,13 @@
buildPythonPackage rec {
pname = "sanic-testing";
version = "0.8.2";
version = "22.3.0";
src = fetchFromGitHub {
owner = "sanic-org";
repo = "sanic-testing";
rev = "v${version}";
sha256 = "17fbb78gvic5s9nlcgwj817fq1f9j9d1d7z6n2ahhinmvyzl9gc8";
sha256 = "sha256-ZsLQA8rP4RrbVSUy5n0WZs903fnF7jtFqrIe5JVuRIg=";
};
outputs = [
@ -23,11 +23,6 @@ buildPythonPackage rec {
"testsout"
];
postPatch = ''
substituteInPlace setup.py \
--replace "httpx>=0.18,<0.22" "httpx"
'';
propagatedBuildInputs = [
httpx
sanic

View File

@ -24,32 +24,23 @@
buildPythonPackage rec {
pname = "sanic";
version = "21.12.1";
version = "22.3.2";
format = "setuptools";
disabled = pythonOlder "3.7" ||
pythonAtLeast "3.10"; # see GHSA-7p79-6x2v-5h88
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "sanic-org";
repo = pname;
rev = "v${version}";
sha256 = "0jyl23q7b7fyqzan97qflkqcvmfpzbxbzv0qgygxasrzh80zx67g";
hash = "sha256-4zdPp3X22dfZ5YlW3G5/OqeUxrt+NiFO9dk2XjEKXEg=";
};
postPatch = ''
# Loosen dependency requirements.
substituteInPlace setup.py \
--replace "pytest==6.2.5" "pytest" \
--replace "gunicorn==20.0.4" "gunicorn" \
--replace "multidict>=5.0,<6.0" "multidict"
sed '/pytest-sanic/d' setup.py
# Patch a request headers test to allow brotli encoding
# (we build httpx with brotli support, upstream doesn't).
substituteInPlace tests/test_headers.py \
--replace "deflate\r\n" "deflate, br\r\n"
--replace "gunicorn==20.0.4" "gunicorn"
'';
propagatedBuildInputs = [
@ -66,8 +57,6 @@ buildPythonPackage rec {
beautifulsoup4
gunicorn
pytest-asyncio
pytest-benchmark
pytest-sugar
pytestCheckHook
sanic-testing
uvicorn
@ -95,49 +84,27 @@ buildPythonPackage rec {
];
disabledTests = [
# Lack of uvloop setup through fixtures
"test_create_asyncio_server"
"test_listeners_triggered_async"
"test_tls_options"
# Tests are flaky
# Fails to parse cmdline arguments
"test_dev"
"test_auto_reload"
# OSError: foo
"test_bad_headers"
"test_create_server_trigger_events"
"test_json_body_requests"
"test_missing_startup_raises_exception"
"test_no_body_requests"
"test_oserror_warning"
"test_running_multiple_offset_warning"
"test_streaming_body_requests"
"test_trigger_before_events_create_server"
"test_keep_alive_connection_context"
# Racy tests
"test_keep_alive_client_timeout"
"test_check_timeouts_request_timeout"
"test_check_timeouts_response_timeout"
"test_reloader_live"
"test_zero_downtime"
# Not working from 21.9.1
"test_create_server_main"
"test_create_server_main_convenience"
"test_debug"
"test_auto_reload"
"test_no_exceptions_when_cancel_pending_request"
"test_ipv6_address_is_not_wrapped"
# Failure of the redirect tests seems to be related to httpx>0.20.0
"test_redirect"
"test_chained_redirect"
"test_unix_connection"
# These appear to be very sensitive to output of commands
"test_access_logs"
"test_auto_reload"
"test_host_port"
"test_no_exceptions_when_cancel_pending_request"
"test_num_workers"
"test_server_run"
"test_version"
# Sensitive comparison of raw HTTP header fails
"test_raw_headers"
# noisy_exceptions sometimes missing from sanic stdout
"test_noisy_exceptions"
] ++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [
# test fail on aarch64
"test_tls_wrong_options"
"test_cookie_expires"
"test_gunicorn_worker"
"test_gunicorn_worker_no_logs"
"test_gunicorn_worker_with_logs"
];
disabledTestPaths = [
# We are not interested in benchmarks
"benchmark/"
# unable to create async loop
"test_app.py"
"test_asgi.py"