aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprspkt <prspkt@protonmail.com>2019-06-19 08:37:28 +0300
committerprspkt <prspkt@protonmail.com>2019-06-19 09:33:13 +0300
commitcd89bb2333dc39350737d918bffb61831eeb8b28 (patch)
tree61fe1f8ceb8e714d3838b7a6428bf608e477b440
parentdf47d91d182c2096effab8e749584b957f611727 (diff)
downloadalpine_aports-cd89bb2333dc39350737d918bffb61831eeb8b28.tar.bz2
alpine_aports-cd89bb2333dc39350737d918bffb61831eeb8b28.tar.xz
alpine_aports-cd89bb2333dc39350737d918bffb61831eeb8b28.zip
testing/py3-pyhamcrest: add checkdepends and run test suite
* Switch source to github as it provides a test suite. * Since pytest4 no longer supports the _pytest.mark.parametrize_ function call, some tests will fail. Import patch from fedora to enable compatibility with pytest4.
-rw-r--r--testing/py3-pyhamcrest/APKBUILD16
-rw-r--r--testing/py3-pyhamcrest/silence-warnings.patch87
2 files changed, 101 insertions, 2 deletions
diff --git a/testing/py3-pyhamcrest/APKBUILD b/testing/py3-pyhamcrest/APKBUILD
index 00db8a5a83..77e93b5248 100644
--- a/testing/py3-pyhamcrest/APKBUILD
+++ b/testing/py3-pyhamcrest/APKBUILD
@@ -12,17 +12,29 @@ replaces="py3-hamcrest"
12provides="py3-hamcrest=$pkgver-r$pkgrel" 12provides="py3-hamcrest=$pkgver-r$pkgrel"
13depends="py3-six python3" 13depends="py3-six python3"
14makedepends="py3-setuptools python3-dev" 14makedepends="py3-setuptools python3-dev"
15source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz" 15checkdepends="py3-hypothesis py3-mock py3-pytest"
16source="$_pkgname-$pkgver.tar.gz::https://github.com/hamcrest/PyHamcrest/archive/V$pkgver.tar.gz
17 silence-warnings.patch"
16builddir="$srcdir/"$_pkgname-$pkgver 18builddir="$srcdir/"$_pkgname-$pkgver
17 19
20prepare() {
21 default_prepare
22 rm -f pytest.ini
23}
24
18build() { 25build() {
19 cd "$builddir" 26 cd "$builddir"
20 python3 setup.py build 27 python3 setup.py build
21} 28}
22 29
30check() {
31 PYTHONPATH="build/lib" py.test-3
32}
33
23package() { 34package() {
24 cd "$builddir" 35 cd "$builddir"
25 python3 setup.py install --prefix=/usr --root="$pkgdir" 36 python3 setup.py install --prefix=/usr --root="$pkgdir"
26} 37}
27 38
28sha512sums="3b8393d0079b619b208ec7f06ed5133c4ff9d9dba050f818adf56347fc2225fd1c85d60f3dc262b7b9722061f0b8e4966180b6b96245a371e578d0d51633b4b0 PyHamcrest-1.9.0.tar.gz" 39sha512sums="3a878637ed5138365416c170871a63640f089047b723c7ec8db893dd716c0b1cdad16a98584700405693b954af7d4868a8543d1a3fc58ded22b493c8c61661b4 PyHamcrest-1.9.0.tar.gz
408320f8c832ed3f90c11242b3bd6fad2327b3d6d1cda9a025b80453a4e69a34d39d338a21601f412d4f1903eab74bf7217c21e5ac31f84091e2f11cf6369a5658 silence-warnings.patch"
diff --git a/testing/py3-pyhamcrest/silence-warnings.patch b/testing/py3-pyhamcrest/silence-warnings.patch
new file mode 100644
index 0000000000..dfae1b8497
--- /dev/null
+++ b/testing/py3-pyhamcrest/silence-warnings.patch
@@ -0,0 +1,87 @@
1From a916909e315eb219f79b99d927c54028d7af1fc4 Mon Sep 17 00:00:00 2001
2From: Simon Brunning <simon@brunningonline.net>
3Date: Fri, 2 Nov 2018 09:50:20 +0000
4Subject: [PATCH] Silence warnings from tests due to use of old
5 pytest.parameterize() signature.
6
7---
8 tests/hamcrest_unit_test/base_description_test.py | 8 ++++----
9 tests/hamcrest_unit_test/core/is_test.py | 4 ++--
10 tests/hamcrest_unit_test/core/isinstanceof_test.py | 8 ++++----
11 3 files changed, 10 insertions(+), 10 deletions(-)
12
13diff --git a/tests/hamcrest_unit_test/base_description_test.py b/tests/hamcrest_unit_test/base_description_test.py
14index 43d9bc9..ce76557 100644
15--- a/tests/hamcrest_unit_test/base_description_test.py
16+++ b/tests/hamcrest_unit_test/base_description_test.py
17@@ -34,10 +34,10 @@ def test_append_text_delegates(desc):
18
19 @pytest.mark.parametrize('described, appended', (
20 (Described(), 'described'),
21- pytest.mark.skipif(six.PY3, reason="py2 only")((six.u('unicode-py2'), "'unicode-py2'")),
22- pytest.mark.skipif(six.PY3, reason="py2 only")((six.b('bytes-py2'), "'bytes-py2'")),
23- pytest.mark.skipif(six.PY2, reason="py3 only")((six.u('unicode-py3'), "'unicode-py3'")),
24- pytest.mark.skipif(six.PY2, reason="py3 only")((six.b('bytes-py3'), "<b'bytes-py3'>")),
25+ pytest.param(six.u('unicode-py2'), "'unicode-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
26+ pytest.param(six.b('bytes-py2'), "'bytes-py2'", marks=pytest.mark.skipif(six.PY3, reason="py2 only")),
27+ pytest.param(six.u('unicode-py3'), "'unicode-py3'", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
28+ pytest.param(six.b('bytes-py3'), "<b'bytes-py3'>", marks=pytest.mark.skipif(six.PY2, reason="py3 only")),
29 (six.u("\U0001F4A9"), six.u("'{0}'").format(six.u("\U0001F4A9"))),
30 ))
31 def test_append_description_types(desc, described, appended):
32diff --git a/tests/hamcrest_unit_test/core/is_test.py b/tests/hamcrest_unit_test/core/is_test.py
33index 9205ddb..632c67c 100644
34--- a/tests/hamcrest_unit_test/core/is_test.py
35+++ b/tests/hamcrest_unit_test/core/is_test.py
36@@ -39,7 +39,7 @@ def test_description_should_pass_through_matcher():
37 equal_matches = pytest.mark.parametrize('arg, identity, desc', (
38 ('A', 'A', "'A'"),
39 (5 + 3, 8, "<8>"),
40- pytest.mark.issue56((tuple(), (), "<()>")),
41+ pytest.param(tuple(), (), "<()>", marks=pytest.mark.issue56()),
42 ))
43
44 equal_mismatches = pytest.mark.parametrize('arg, identity, desc', (
45@@ -65,7 +65,7 @@ def test_description_uses_equal_to(arg, identity, desc):
46 @pytest.mark.parametrize('arg, identity', (
47 ('A', str),
48 (1, int),
49- only_py2((OldClass(), OldClass)),
50+ pytest.param(OldClass(), OldClass, marks=only_py2()),
51 ))
52 def test_provides_instanceof_shortcut(arg, identity):
53 assert_matches(is_(identity), arg, "should match")
54diff --git a/tests/hamcrest_unit_test/core/isinstanceof_test.py b/tests/hamcrest_unit_test/core/isinstanceof_test.py
55index 862fd06..f74b84d 100644
56--- a/tests/hamcrest_unit_test/core/isinstanceof_test.py
57+++ b/tests/hamcrest_unit_test/core/isinstanceof_test.py
58@@ -26,7 +26,7 @@ class Child(Parent):
59 ('foo', instance_of((str, int))),
60 (1, instance_of((int, str))),
61 ('foo', instance_of((int, str))),
62- only_py2((Parent(), instance_of(Parent))),
63+ pytest.param(Parent(), instance_of(Parent), marks=only_py2()),
64 ))
65 def test_matching_evaluation(arg, matcher):
66 assert_matches(matcher, arg, 'same class')
67@@ -35,14 +35,14 @@ def test_matching_evaluation(arg, matcher):
68 @pytest.mark.parametrize('arg, matcher', (
69 ('hi', instance_of(int)),
70 (None, instance_of(int)),
71- only_py2(('not a parent', instance_of(Parent))),
72- only_py2((None, instance_of(Parent))),
73+ pytest.param('not a parent', instance_of(Parent), marks=only_py2()),
74+ pytest.param(None, instance_of(Parent), marks=only_py2()),
75 ))
76 def test_mismatching_evaluation(arg, matcher):
77 assert_does_not_match(matcher, arg, 'mismatched')
78
79 @pytest.mark.parametrize('obj', (
80- pytest.mark.issue56(()),
81+ pytest.param((), marks=pytest.mark.issue56()),
82 'str',
83 ))
84 def test_matcher_creation_requires_type(obj):
85--
862.21.0
87