summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a07a6f4431dd35da7e1d81f307156645ae34422e (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
54
# Maintainer: Gesh <gesh@gesh.uni.cx>
# Contributor: Achmad Fathoni<fathoni.id(at)gmail.com>

pkgname=python-pytest-recording
_pkgname=${pkgname#python-}
pkgver=0.13.4
pkgrel=1
pkgdesc='Pytest plugin to record network interactions with VCR.py'
arch=('any')
url="https://pypi.org/project/${_pkgname//-/_}"
_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=('c86e695e95acbe0ad2576410397950193a78de65be0c91c98f4ba7fa8e705a3e')

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
    # Can't pass these via -p for some reason, see
    # https://github.com/pytest-dev/pytest/issues/13388
    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"
}