# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-concurrent-log-handler
_pyname=concurrent-log-handler
pkgver=0.9.25
pkgrel=2
arch="noarch"
pkgdesc="RotatingFileHandler replacement with concurrency, gzip and Windows support"
url="https://pypi.python.org/project/concurrent-log-handler"
license="Apache-2.0"
depends="
	py3-portalocker
	"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
	py3-hatchling
	"
checkdepends="py3-pytest"
source="
	$pkgname-$pkgver-gh.tar.gz::https://github.com/Preston-Landers/concurrent-log-handler/archive/refs/tags/$pkgver.tar.gz
	null-failing-test-units.patch
	"
builddir="$srcdir"/$_pyname-$pkgver
subpackages="$pkgname-pyc"

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 .dist/*.whl
	# FAILED tests/test_stresstest.py::test_run_stress_test[backupCount=3, use_gzip=True, use_timed=True, interval=3, log_calls=3_000, num_processes=4-test_opts11] - AssertionError: assert 1 == 0 +  where 1 = run_stress_test(TestOptions(log_opts={'maxBytes': 0, 'when': 'S', 'interval': 3, 'backupCount': 3, 'encoding': 'utf-8', 'debug': False, 'use_gzip': True}, log_file='stress_test.log', log_dir='output_tests', num_processes=4, log_calls=3000, use_asyncio=False, induce_failure=False, sleep_min=0.0001, sleep_max=0.01, use_timed=True, min_rollovers=4))
	# FAILED tests/test_stresstest.py::test_run_stress_test[backupCount=5, use_timed=True, maxBytes=1KiB, interval=5, log_calls=1_000, use_gzip=True, debug=True-test_opts14] - AssertionError: assert 1 == 0 +  where 1 = run_stress_test(TestOptions(log_opts={'maxBytes': 1024, 'when': 'S', 'interval': 5, 'backupCount': 5, 'encoding': 'utf-8', 'debug': True, 'use_gzip': True}, log_file='stress_test.log', log_dir='output_tests', num_processes=10, log_calls=1000, use_asyncio=False, induce_failure=False, sleep_min=0.0001, sleep_max=0.01, use_timed=True, min_rollovers=5))
	.testenv/bin/python3 -m pytest -v
}

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

sha512sums="
682f33a9a81c78e7c07bcf7c30f5955100a2846d08d3da4331ec8d155e5a35c92e224bafbb848b121b41ab2e84b60b35a31034185b57b7c02ea4bdaaccf8c4ac  py3-concurrent-log-handler-0.9.25-gh.tar.gz
dab453965b9f8c476ade755e8a182b15b210dd186cedbdd47b63596c635bbe2adf1b186e1888d7b83154f18da34a1a08022d403356028bb08af679a50ff84433  null-failing-test-units.patch
"
