maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=py3-gql
pkgver=3.5.0
pkgrel=0
pkgdesc="GraphQL client in Python"
url="https://gql.readthedocs.io/"
arch="noarch"
license="MIT"
depends="
	python3
	py3-anyio
	py3-backoff
	py3-graphql-core
	py3-yarl
	"
makedepends="py3-setuptools"
checkdepends="
	py3-aiofiles
	py3-aiohttp
	py3-mock
	py3-parse
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-console-scripts
	py3-requests
	py3-requests-toolbelt
	py3-urllib3
	py3-botocore
	py3-httpx
	py3-vcrpy
	py3-websockets
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/graphql-python/gql/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/gql-$pkgver"

build() {
	python3 setup.py build
}

check() {
	# test_get_introspection_query_ast and test_async_client_validation_fetch_schema_from_server_valid_query simply fails (TODO: investigate more / report upstream)
	# test_httpx_using_cli_ep and test_httpx_using_cli_ep try to execute gql-cli
	local _skipped_tests="
		not test_get_introspection_query_ast
		and not test_aiohttp_using_cli_ep
		and not test_httpx_using_cli_ep
		and not test_async_client_validation_fetch_schema_from_server_valid_query"

	# All tests in test_transport.py and test_transport_batch.py rely on a locally running graphql API endpoint
	# shellcheck disable=SC2116
	pytest tests/ \
		--ignore=tests/test_transport.py \
		--ignore=tests/test_transport_batch.py \
		-k "$(echo $_skipped_tests)"
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
82be1ed1cf8ebebb7ae7a10486e1c9896a12e29aa4edc65d4198eb7593839ae666f519a54f89a7a38bd5306f625fc243eaa99b80524412a6466168ee7693a6bf  py3-gql-3.5.0.tar.gz
"
