# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-moto
pkgver=5.0.21
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
	.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=tests/test_iot/test_iot_integration.py
}

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

sha512sums="
be2dadc669ea6ddf2dd7ee3c02c8bf71a1bf16a054cf0d0dd139a2ae8f595517e7976574a8e0fcb30519b2d82c17051d649220585be8e77ccd008f0ba1b2d39a  py3-moto-5.0.21.tar.gz
"
