# Maintainer: Mohamed Amine Zghal (medaminezghal) <medaminezghal at outlook dot com>

_name=pytest-watcher
pkgname=python-${_name}
pkgver=0.6.3
pkgrel=1
pkgdesc="Automatically rerun your tests on file modifications."
arch=('any')
url='https://github.com/olzhasar/pytest-watcher'
license=('MIT')
source=("python-${_name}::git+https://github.com/olzhasar/pytest-watcher.git#tag=v${pkgver}")
sha256sums=('b60f897277e08043ff45a72bda4ea2ae82978f5ddc28f80c558098cc1b482a8f')
depends=('python' 'python-watchdog')
makedepends=('python-poetry-core' 'python-build' 'python-installer' 'python-wheel' 'git' 'python-hatchling' 'python-hatch-vcs')
checkdepends=('python-pytest' 'python-pytest-mock' 'python-freezegun')

build() {
  cd "${srcdir}"/python-${_name}
  python -m build --wheel --no-isolation
}

check() {
  local pytest_options=(
    -vv
  )
  cd "${srcdir}"/python-${_name}
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest "${pytest_options[@]}" tests
}

package() {
  cd "${srcdir}"/python-${_name}
  python -m installer --destdir="$pkgdir" dist/*.whl
}
