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

pkgname=python-requests-mock
pkgver=1.12.1
_commit=fba8cc7faf83be9f1505625d566721ee6c68ed39
pkgrel=2
pkgdesc="A mock of useful classes and functions to be used with python-requests."
arch=('any')
url="https://github.com/jamielennox/requests-mock"
license=('Apache')
depends=('python-requests' 'python')
makedepends=('git' 'python-setuptools' 'python-setuptools-scm' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-purl' 'python-pytest' 'python-requests-futures' 'python-testtools' 'python-fixtures' 'python-pbr')
source=("git+https://github.com/jamielennox/requests-mock.git#commit=$_commit"
         fix-test.patch)
sha512sums=('2e539ac04e950f08a6de44355a2d6e878980b7c86a8ddcbaf2ce526de6f4342f61fe51874e5b64809723a1295e2f00f8ee451f643d407327e1284df1602f5537'
            '1cbf5131d3fef9d5fe57d502f73856347b9910a2fffba45305df4c835717f945e97ac95f776408869780912ae3d84106c0824e08fcd88ff1cb97f742dfc48686')

prepare() {
  cd requests-mock
  patch -p1 -i ../fix-test.patch
}

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

check() {
  cd requests-mock
  python -m pytest tests/pytest
  python -m testtools.run discover
}

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