# Contributor: Felix Yan pkgbase=python-flaky pkgname=('python3-flaky' 'python2-flaky') pkgver=3.4.0 pkgrel=1 pkgdesc='Plugin for nose or py.test that automatically reruns flaky tests' arch=('any') license=('Apache') url='https://github.com/box/flaky' makedepends=('python3-setuptools' 'python2-setuptools') checkdepends=('python3-pytest' 'python2-pytest' 'python3-nose' 'python2-nose' 'python3-genty' 'python2-genty' 'python3-mock' 'python2-mock') source=("$pkgbase-$pkgver.tar.gz::https://github.com/box/flaky/archive/v$pkgver.tar.gz") sha512sums=('1e0902d1fc1566e11e64c6a983617d63109f6277fc51e42a88d9d1d7115dd2234636b0833df3aba22838427b792caa65638c33e75f86b3d402054923af3ffd66') prepare() { cp -a flaky-$pkgver{,-py2} } build() { cd "$srcdir"/flaky-$pkgver python3 setup.py build cd "$srcdir"/flaky-$pkgver-py2 python2 setup.py build } check() { # Hack entry points by installing it cd "$srcdir"/flaky-$pkgver python3 setup.py install --root="$PWD/tmp_install" --optimize=1 ( export PYTHONPATH="$PWD/tmp_install/usr/lib/python3.6/site-packages:$PYTHONPATH" nosetests3 --with-flaky --exclude="test_nose_options_example" test/test_nose/ py.test -k 'example and not options' --doctest-modules test/test_pytest/ py.test -p no:flaky test/test_pytest/test_flaky_pytest_plugin.py nosetests3 --with-flaky --force-flaky --max-runs 2 test/test_nose/test_nose_options_example.py py.test --force-flaky --max-runs 2 test/test_pytest/test_pytest_options_example.py ) cd "$srcdir"/flaky-$pkgver-py2 python2 setup.py install --root="$PWD/tmp_install" --optimize=1 ( export PYTHONPATH="$PWD/tmp_install/usr/lib/python2.7/site-packages:$PYTHONPATH" nosetests2 --with-flaky --exclude="test_nose_options_example" test/test_nose/ py.test2 -k 'example and not options' --doctest-modules test/test_pytest/ py.test2 -p no:flaky test/test_pytest/test_flaky_pytest_plugin.py nosetests2 --with-flaky --force-flaky --max-runs 2 test/test_nose/test_nose_options_example.py py.test2 --force-flaky --max-runs 2 test/test_pytest/test_pytest_options_example.py ) } package_python3-flaky() { depends=('python3') cd "$srcdir"/flaky-$pkgver python3 setup.py install --root="$pkgdir" --optimize=1 } package_python2-flaky() { depends=('python2') cd "$srcdir"/flaky-$pkgver-py2 python2 setup.py install --root="$pkgdir" --optimize=1 } # vim:set ts=2 sw=2 et: