# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-moto
pkgver=5.1.5
pkgrel=0
#_pkgreal is used by apkbuild-pypi to find modules at PyPI
_pkgreal=moto
pkgdesc="A library that allows you to easily mock out tests based on AWS infrastructure."
url="https://github.com/getmoto/moto"
# loongarch64: blocked by py3-openapi-spec-validator
arch="noarch !loongarch64"
license="Apache-2.0"
depends="
	py3-boto3
	py3-botocore
	py3-cryptography
	py3-requests
	py3-xmltodict
	py3-werkzeug
	py3-dateutil
	py3-responses
	py3-jinja2
	py3-jsonpath-ng
"
checkdepends="
	py3-pytest
	py3-coverage
	py3-pytest-cov
	py3-pytest-xdist
	py3-freezegun
	py3-pylint
	py3-flask
	py3-flask-cors
	py3-openapi-spec-validator
	py3-docker-py
"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/getmoto/moto/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer "$builddir"/.dist/*.whl
	# tests/test_cognitoidp: missing module joserfc
	# tests/test_iotdata: missing module jsondiff
	# tests/test_xray: missing module aws_xray_sdk
	# tests/test_apigateway/test_apigateway.py: missing module joserfc
	# tests/test_appsync/test_appsync_schema.py: missing module graphql
	# tests/test_awslambda: requires do_eventsourcemappingcker
	# tests/test_batch/test_batch_jobs.py: timeout error
	# tests/test_cloudformation: missing module cfnlint + timeout error
	# tests/test_core/test_docker.py: requires docker
	# tests/test_dynamodb/test_dynamodb_statements.py: missing module py_partiql_parser
	# tests/test_events/test_events_lambdatriggers_integration.py: requires docker
	# tests/test_logs/test_integration.py: requires docker
	# tests/test_resiliencehub/test_resiliencehub.py: botocore.exceptions.ParamValidationError: Parameter validation failed
	# tests/test_s3/test_s3_lambda_integration.py: requires docker
	# tests/test_s3/test_s3_select.py: missing module py_partiql_parser
	# tests/test_secretsmanager/test_secretsmanager.py: AttributeError: 'SecretsManager' object has no attribute 'batch_get_secret_value'. Did you mean: 'get_secret_value'?
	# tests/test_sqs/test_sqs_integration.py: requires docker
	# tests/test_stepfunctions/parser: missing module antlr4
	# tests/test_resiliencehub/test_resiliencyhub_resources.py: key error: creationTime
	# tests/test_ssoadmin/test_ssoadmin.py: AttributeError: 'SSOAdmin' object has no attribute 'list_account_assignments_for_principal'. Did you mean: 'list_account_assignment_creation_status
	# tests/test_s3/{test_server.py,test_multiple_accounts_server.py}: Failed to establish a new connection: [Errno -2] Name does not resolve'
	# tests/test_dynamodb/test_dynamodb_import_table.py:  AssertionError: assert 'FAILED' == 'COMPLETED'
	# tests/test_iot/test_iot_integration.py::test_search_things_include_named_shadow: missing py3-jsondiff checkdepends
	# moto/stepfunctions/parser/asl/component/test_state/program/test_state_program.py, and co: missing module antlr4
	# other_langs/tests_sagemaker_client/test_model_training.py: missing module sagemaker
	# tests/test_stepfunctions/test_stepfunctions_versions.py::test_describe_state_machine_using_version_arn[use_parser]: missing module antlr4
	# tests/test_firehose/test_firehose_put.py::test_put_record_http_destination: runtimeError: Firehose PutRecord(Batch) to HTTP destination failed on armv7
	.testenv/bin/python3 -m pytest -v \
		--ignore=tests/test_cognitoidp \
		--ignore=tests/test_iotdata \
		--ignore=tests/test_xray \
		--ignore=tests/test_apigateway/test_apigateway.py \
		--ignore=tests/test_appsync/test_appsync_schema.py \
		--ignore=tests/test_awslambda \
		--ignore=tests/test_batch/test_batch_jobs.py \
		--ignore=tests/test_cloudformation \
		--ignore=tests/test_core/test_docker.py \
		--ignore=tests/test_dynamodb/test_dynamodb_statements.py \
		--ignore=tests/test_events/test_events_lambdatriggers_integration.py \
		--ignore=tests/test_logs/test_integration.py \
	  	--ignore=tests/test_resiliencehub/test_resiliencehub.py \
		--ignore=tests/test_s3/test_s3_lambda_integration.py \
		--ignore=tests/test_s3/test_s3_select.py \
		--ignore=tests/test_secretsmanager/test_secretsmanager.py \
		--ignore=tests/test_sqs/test_sqs_integration.py \
		--ignore=tests/test_stepfunctions/parser \
		--ignore=tests/test_resiliencehub/test_resiliencyhub_resources.py \
		--ignore=tests/test_ssoadmin/test_ssoadmin.py \
		--ignore=tests/test_s3/test_multiple_accounts_server.py \
		--ignore=tests/test_s3/test_server.py \
		--ignore=tests/test_dynamodb/test_dynamodb_import_table.py \
		--ignore=moto/stepfunctions/parser/asl/component/test_state/program/test_state_program.py \
		--ignore=moto/stepfunctions/parser/asl/component/test_state/state/test_state_state_props.py \
		--ignore=moto/stepfunctions/parser/asl/static_analyser/test_state/test_state_analyser.py \
		--ignore=tests/test_iot/test_iot_integration.py \
		--ignore=other_langs/tests_sagemaker_client/test_model_training.py \
		--deselect='tests/test_stepfunctions/test_stepfunctions_versions.py::test_describe_state_machine_using_version_arn[use_parser]' \
		--deselect=tests/test_firehose/test_firehose_put.py::test_put_record_http_destination
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
2ed988e62be103edfe49ec1100bfdfa2dca8df6a9efa28f6b1ed244df3a31052467ccb491f6feae9a4131c17088a9628e819e066bb59695fe13c335f81468490  py3-moto-5.1.5.tar.gz
"
