summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a28c7243b2f5aa778861df0aca4df208983d3fdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Maintainer: Gesh <gesh@gesh.uni.cx>
# Contributor: Achmad Fathoni<fathoni.id(at)gmail.com>

pkgname=python-pytest-recording
pkgver=0.13.2
pkgrel=6
_name=${pkgname#python-}
_name="${_name//-/_}"
pkgdesc='Pytest plugin to record network interactions with VCR.py'
arch=('any')
url="https://pypi.org/project/$_name"
_url='https://github.com/kiwicom/pytest-recording'
license=('MIT')
depends=(python 'python-vcrpy>=7.0.0' python-pytest)
makedepends=(python-build python-installer python-hatchling)
optdepends=(
    'python-pycurl: Block pycurl-based network connections'
)
checkdepends=(
    python-coverage
    python-pytest
    python-pytest-httpbin
    python-pytest-mock
    python-requests
    python-werkzeug
)
source=("$pkgname-$pkgver::${_url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('979a7849e758ed1d6ba17056533c75ac901f30a420d8229342bf4c5043cb86fb')

build() {
    cd "$pkgname-$pkgver"
    python -m build --wheel --no-isolation

    python -m installer --destdir=tmp_install dist/*.whl
}

check() {
    cd "$pkgname-$pkgver"

    local _site_packages
    _site_packages="$(python -c 'import site; print(site.getsitepackages()[0])')"
    export PYTHONPATH="$PWD/tmp_install/$_site_packages"
    export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
    export PYTEST_PLUGINS=pytest_httpbin.plugin,pytest_mock,pytest_recording.plugin

    python -m pytest
}

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