From a6d1fe3c0341d206e92a03552aa0aa30affd93b5 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 24 Sep 2024 09:43:11 +0200 Subject: [PATCH] python312Packages.moto: add more optional-dependencies --- .../python-modules/moto/default.nix | 186 +++++++++++++----- 1 file changed, 138 insertions(+), 48 deletions(-) diff --git a/pkgs/development/python-modules/moto/default.nix b/pkgs/development/python-modules/moto/default.nix index b95fb5b8988d..99a1f58beb1c 100644 --- a/pkgs/development/python-modules/moto/default.nix +++ b/pkgs/development/python-modules/moto/default.nix @@ -1,45 +1,38 @@ { lib, - buildPythonPackage, - fetchPypi, - pythonOlder, - - # build-system - setuptools, - - # dependencies - boto3, - botocore, - cryptography, - jinja2, - python-dateutil, - requests, - responses, - werkzeug, - xmltodict, - - # optional-dependencies antlr4-python3-runtime, aws-xray-sdk, + boto3, + botocore, + buildPythonPackage, cfn-lint, - flask, - flask-cors, + crc32c, + cryptography, docker, + fetchPypi, + flask-cors, + flask, + freezegun, graphql-core, + jinja2, joserfc, - jsonpath-ng, jsondiff, + jsonpath-ng, multipart, openapi-spec-validator, py-partiql-parser, pyparsing, - pyyaml, - - # tests - freezegun, - pytestCheckHook, pytest-order, pytest-xdist, + pytestCheckHook, + python-dateutil, + pythonOlder, + pyyaml, + requests, + responses, + setuptools, + werkzeug, + xmltodict, }: buildPythonPackage rec { @@ -47,7 +40,7 @@ buildPythonPackage rec { version = "5.0.16"; pyproject = true; - disabled = pythonOlder "3.6"; + disabled = pythonOlder "3.8"; src = fetchPypi { inherit pname version; @@ -69,7 +62,6 @@ buildPythonPackage rec { ]; optional-dependencies = { - # non-exhaustive list of extras, that was cobbled together for testing all = [ antlr4-python3-runtime aws-xray-sdk @@ -83,21 +75,111 @@ buildPythonPackage rec { jsonpath-ng multipart openapi-spec-validator - pyparsing py-partiql-parser + pyparsing + pyyaml + setuptools + ]; + proxy = [ + antlr4-python3-runtime + aws-xray-sdk + cfn-lint + docker + graphql-core + joserfc + jsondiff + jsonpath-ng + multipart + openapi-spec-validator + py-partiql-parser + pyparsing + pyyaml + setuptools + ]; + server = [ + antlr4-python3-runtime + aws-xray-sdk + cfn-lint + docker + flask + flask-cors + graphql-core + joserfc + jsondiff + jsonpath-ng + openapi-spec-validator + py-partiql-parser + pyparsing pyyaml setuptools ]; cognitoidp = [ joserfc ]; + apigateway = [ + pyyaml + joserfc + openapi-spec-validator + ]; + apigatewayv2 = [ + pyyaml + openapi-spec-validator + ]; + cloudformation = [ + aws-xray-sdk + cfn-lint + docker + graphql-core + joserfc + jsondiff + openapi-spec-validator + py-partiql-parser + pyparsing + pyyaml + setuptools + ]; + dynamodb = [ + docker + py-partiql-parser + ]; + dynamodbstreams = [ + docker + py-partiql-parser + ]; + events = [ jsonpath-ng ]; + glue = [ pyparsing ]; + iotdata = [ jsondiff ]; + resourcegroupstaggingapi = [ + cfn-lint + docker + graphql-core + joserfc + jsondiff + openapi-spec-validator + py-partiql-parser + pyparsing + pyyaml + ]; + s3 = [ + pyyaml + py-partiql-parser + ]; + stepfunctions = [ + antlr4-python3-runtime + jsonpath-ng + ]; + s3crc32c = [ + pyyaml + py-partiql-parser + crc32c + ]; }; __darwinAllowLocalNetworking = true; nativeCheckInputs = [ freezegun - pytestCheckHook pytest-order pytest-xdist + pytestCheckHook ] ++ optional-dependencies.all; # Some tests depend on AWS credentials environment variables to be set. @@ -111,36 +193,44 @@ buildPythonPackage rec { # Matches upstream configuration, presumably due to expensive setup/teardown. "--dist" "loadscope" + ]; + disabledTests = [ # Fails at local name resolution - "--deselect=tests/test_s3/test_multiple_accounts_server.py::TestAccountIdResolution::test_with_custom_request_header" - "--deselect=tests/test_s3/test_server.py::test_s3_server_post_cors_multiple_origins" - "--deselect=tests/test_s3/test_s3_file_handles.py::TestS3FileHandleClosuresUsingMocks::test_create_multipart" - "--deselect=tests/test_core/test_responses_module.py::TestResponsesMockWithPassThru::test_aws_and_http_requests" - "--deselect=tests/test_core/test_responses_module.py::TestResponsesMockWithPassThru::test_http_requests" + "test_with_custom_request_header" + "test_s3_server_post_cors_multiple_origins" + "test_create_multipart" + "test_aws_and_http_requests" + "test_http_requests" # Fails at resolving google.com - "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_http_destination" - "--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_batch_http_destination" + "test_put_record_http_destination" + "test_put_record_batch_http_destination" # Fails at resolving s3.amazonaws.com - "--deselect=tests/test_core/test_request_passthrough.py::test_passthrough_calls_for_wildcard_urls" - "--deselect=tests/test_core/test_request_passthrough.py::test_passthrough_calls_for_specific_url" - "--deselect=tests/test_core/test_request_passthrough.py::test_passthrough_calls_for_entire_service" + "test_passthrough_calls_for_wildcard_urls" + "test_passthrough_calls_for_specific_url" + "test_passthrough_calls_for_entire_service" # Download recordings returns faulty JSON - "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_ec2_instance_creation_recording_on" - "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_ec2_instance_creation__recording_off" + "test_ec2_instance_creation_recording_on" + "test_ec2_instance_creation__recording_off" # Connection Reset by Peer, when connecting to localhost:5678 - "--deselect=tests/test_moto_api/recorder/test_recorder.py::TestRecorder::test_replay" + "test_replay" # Flaky under parallel execution - "--deselect=tests/test_cloudformation/test_server.py::test_cloudformation_server_get" - "--deselect=tests/test_core/test_moto_api.py::TestModelDataResetForClassDecorator::test_should_find_bucket" + "test_cloudformation_server_get" + "test_should_find_bucket" # AssertionError: assert ResourceWarning not in [, ] - "--deselect=ests/test_s3/test_s3_file_handles.py::TestS3FileHandleClosuresUsingMocks::test_delete_object_with_version" + "test_delete_object_with_version" + + # KeyError beucase of ap-southeast-5-apse5-az + "test_zoneId_in_availability_zones" + + # Parameter validation fails + "test_conditional_write" ]; disabledTestPaths = [ @@ -165,7 +255,7 @@ buildPythonPackage rec { ]; meta = with lib; { - description = "Allows your tests to easily mock out AWS Services"; + description = "Module to allow your tests to easily mock out AWS Services"; homepage = "https://github.com/getmoto/moto"; changelog = "https://github.com/getmoto/moto/blob/${version}/CHANGELOG.md"; license = licenses.asl20;