# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-testscenarios
pkgver=0.5.0
pkgrel=20
pkgdesc="Testscenarios, a pyunit extension for dependency injection"
arch=('any')
license=('Apache-2.0' 'BSD-3-Clause')
url="https://github.com/testing-cabal/testscenarios"
depends=('python-pbr' 'python-testtools')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=("git+https://github.com/testing-cabal/testscenarios.git#tag=0.5"
        "assertEqual-assertEquals.patch"
        "0001-Fix-compatibility-with-newer-testtools.patch")
sha512sums=('04873f0be01ecd815ef33b0ddb7fc72989d5ffdf0063f4efa7946ae26a607cd1f44b8b8bfeafc7917b434681718de52489cf774cec6ddeb5f12f1ac6ced87156'
            'fb421b781cfd17035c449ecda652b379a8d74f4b2120451131bf2b6f5a07c3a704f83eb0de5fca1434906145a126525a06015fcb7172a7595d03cad8eaa8dfe3'
            '5420419ee4b27566d21548913eff0125dee7aa943d882b524e23e99c9ca0de7f67b498c55500bb6d654f55b33bc27ddeef0c9fe34121fbb259dd1d4379a33d02')

prepare() {
  cd testscenarios
  patch -Np1 -i ${srcdir}/assertEqual-assertEquals.patch
  patch -Np1 -i ${srcdir}/0001-Fix-compatibility-with-newer-testtools.patch
}

build() {
  cd testscenarios
  python -m build --wheel --no-isolation
}

check() {
  cd testscenarios
  python -m testtools.run testscenarios.test_suite
}

package() {
  cd testscenarios
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 BSD -t "$pkgdir"/usr/share/licenses/$pkgname/
}
