aboutsummaryrefslogtreecommitdiffstats
path: root/community/py-hypothesis/APKBUILD
blob: 509c02d62328ee84957645e765f04398634ebde5 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=py-hypothesis
pkgver=4.32.3
pkgrel=0
pkgdesc="Advanced property-based (QuickCheck-like) testing for Python"
url="https://hypothesis.works/"
arch="noarch"
license="MPL-2.0"
_py2_deps="py2-attrs py-enum34"
_py3_deps="py3-attrs"
makedepends="$_py2_deps $_py3_deps py2-setuptools py3-setuptools"
checkdepends="py2-coverage py2-pytest py2-tz py2-numpy py2-dateutil py2-mock
	py3-pytest py3-coverage py3-tz py3-numpy py3-dateutil"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="py-hypothesis-$pkgver.tar.gz::https://github.com/HypothesisWorks/hypothesis-python/archive/hypothesis-python-$pkgver.tar.gz"
builddir="$srcdir/hypothesis-hypothesis-python-$pkgver/hypothesis-python"

prepare() {
	cp -r "$builddir" "$builddir"-py2
}

build() {
	python3 setup.py build
	cd "$builddir"-py2
	python2 setup.py build
}

check() {
	# In python3 mock is actually unittest.mock
	sed -e 's/from mock/from unittest.mock/' -i tests/cover/test_regressions.py
	sed -e 's/from mock/from unittest.mock/' -i tests/cover/test_reflection.py

	# Add variables that will be used by python to find the local
	# hypothesis build
	PY3PATH="${PWD}/build/lib"

	PYTHONPATH="${PY3PATH}" python3 -m pytest tests/cover
	PYTHONPATH="${PY3PATH}" python3 -m pytest tests/py3
	PYTHONPATH="${PY3PATH}" python3 -m pytest tests/datetime
	PYTHONPATH="${PY3PATH}" python3 -m pytest tests/numpy

	cd "$builddir"-py2
	PY2PATH="${PWD}/build/lib"
	PYTHONPATH="${PY2PATH}" python2 -m pytest tests/cover
	PYTHONPATH="${PY2PATH}" python2 -m pytest tests/py2
	PYTHONPATH="${PY2PATH}" python2 -m pytest tests/numpy
	PYTHONPATH="${PY2PATH}" python2 -m pytest tests/datetime
}

package() {
	mkdir -p "$pkgdir"
}

_py2() {
	depends="$_py2_deps"
	cd "$builddir"-py2
	_py python2
}

_py3() {
	depends="$_py3_deps"
	cd "$builddir"
	_py python3
}

_py() {
	_python="$1"
	pkgdesc="$pkgdesc (for $_python)"
	depends="$depends $_python"
	install_if="$pkgname=$pkgver-r$pkgrel $_python"
	$_python setup.py install --prefix=/usr --root="$subpkgdir"
}

sha512sums="e6c37eb73b76810a00eb70f3d6af83fb0baae35c095471253fcd5628c3ee24e95f41389e54aa80c154a6adaeb15c1273b0e4012f4c6df4b1d6f4d7642be487a7  py-hypothesis-4.32.3.tar.gz"