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

pkgname=python-testresources
pkgver=2.0.2
pkgrel=3
pkgdesc="Testresources, a pyunit extension for managing expensive test resources"
arch=('any')
license=('Apache' 'BSD')
url="https://launchpad.net/testresources"
depends=('python')
makedepends=('python-pbr' 'python-testtools' 'git')
checkdepends=('python-fixtures')
source=("git+https://github.com/testing-cabal/testresources.git#tag=$pkgver")
sha512sums=('238e0c311f94aaee81bb4c7d9ee7130216779d6f6d0c7848ba4df5e6b6182ec6d5f0780f23e76e14f70c75e852e1b28c354628b6da0518eb311bc46847a6bec0')

build() {
  cd testresources
  python setup.py build
}

check() {
  cd testresources
  # test_test_resource imports fixtures.tests which is not installed
  # https://bugs.launchpad.net/testresources/+bug/2143037
  python -m testtools.run \
    testresources.tests.test_optimising_test_suite \
    testresources.tests.test_resourced_test_case \
    testresources.tests.test_resource_graph \
    testresources.tests.test_test_loader
}

package() {
  cd testresources
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 COPYING -t "$pkgdir"/usr/share/licenses/$pkgname/
}
