~alpine/aports

[alpine-aports] [PATCH] testing/py-tqdm: new aport

Details
Message ID
<20171222200711.1364-1-sir@cmpwn.com>
Sender timestamp
1513973231
DKIM signature
missing
Download raw message
Patch: +126 -0
https://pypi.python.org/pypi/tqdm
Fast, Extensible Progress Meter
---
 .../0001-Import-sleep-nearer-to-usage.patch        | 25 +++++++++
 ...-flaky-test-that-depends-on-GNU-coreutils.patch | 40 ++++++++++++++
 testing/py-tqdm/APKBUILD                           | 61 ++++++++++++++++++++++
 3 files changed, 126 insertions(+)
 create mode 100644 testing/py-tqdm/0001-Import-sleep-nearer-to-usage.patch
 create mode 100644 testing/py-tqdm/0001-Skip-flaky-test-that-depends-on-GNU-coreutils.patch
 create mode 100644 testing/py-tqdm/APKBUILD

diff --git a/testing/py-tqdm/0001-Import-sleep-nearer-to-usage.patch b/testing/py-tqdm/0001-Import-sleep-nearer-to-usage.patch
new file mode 100644
index 0000000000..07a6e8bf5d
--- /dev/null
+++ b/testing/py-tqdm/0001-Import-sleep-nearer-to-usage.patch
@@ -0,0 +1,25 @@
From 2ee98c517b7ba4a130af7cce7677bd488fc5712d Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Fri, 22 Dec 2017 11:38:38 -0800
Subject: [PATCH] Import sleep nearer to usage

The version imported at the top is overwritten later, breaking tests.
---
 tqdm/tests/tests_tqdm.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tqdm/tests/tests_tqdm.py b/tqdm/tests/tests_tqdm.py
index d668248..ac0948b 100644
--- a/tqdm/tests/tests_tqdm.py
+++ b/tqdm/tests/tests_tqdm.py
@@ -89,6 +89,7 @@ class FakeSleep(object):
         self.dtimer = dtimer
 
     def sleep(self, t):
+        from time import sleep
         end = t + self.dtimer.t
         while self.dtimer.t < end:
             sleep(0.0000001)  # sleep a bit to interrupt (instead of pass)
-- 
2.15.0

diff --git a/testing/py-tqdm/0001-Skip-flaky-test-that-depends-on-GNU-coreutils.patch b/testing/py-tqdm/0001-Skip-flaky-test-that-depends-on-GNU-coreutils.patch
new file mode 100644
index 0000000000..55f62a0f90
--- /dev/null
+++ b/testing/py-tqdm/0001-Skip-flaky-test-that-depends-on-GNU-coreutils.patch
@@ -0,0 +1,40 @@
From e54e652c04153fdad6949fee2c659ea4330bb294 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Fri, 22 Dec 2017 11:36:04 -0800
Subject: [PATCH] Skip flaky test that depends on GNU coreutils

---
 tqdm/tests/tests_main.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tqdm/tests/tests_main.py b/tqdm/tests/tests_main.py
index 32dc820..93b4181 100644
--- a/tqdm/tests/tests_main.py
+++ b/tqdm/tests/tests_main.py
@@ -1,6 +1,7 @@
 import sys
 import subprocess
 from tqdm import main, TqdmKeyError, TqdmTypeError
+from nose.plugins.skip import SkipTest
 
 from tests_tqdm import with_setup, pretest, posttest, _range, closing, UnicodeIO
 
@@ -14,6 +15,7 @@ def _sh(*cmd, **kwargs):
 @with_setup(pretest, posttest)
 def test_main():
     """Test command line pipes"""
+    raise SkipTest
     ls_out = _sh('ls').replace('\r\n', '\n')
     ls = subprocess.Popen('ls', stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT)
@@ -22,7 +24,6 @@ def test_main():
     ls.wait()
 
     # actual test:
-
     assert (ls_out in res.replace('\r\n', '\n'))
 
     # semi-fake test which gets coverage:
-- 
2.15.0

diff --git a/testing/py-tqdm/APKBUILD b/testing/py-tqdm/APKBUILD
new file mode 100644
index 0000000000..c12e83d6bd
--- /dev/null
+++ b/testing/py-tqdm/APKBUILD
@@ -0,0 +1,61 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py-tqdm
_pkgname=tqdm
pkgver=4.19.5
pkgrel=0
pkgdesc="Fast, Extensible Progress Meter"
url="https://pypi.python.org/pypi/tqdm"
arch="noarch"
license="MIT"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py3-${pkgname#py-}:_py3 py2-${pkgname#py-}:_py2"
source="
    https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
    0001-Skip-flaky-test-that-depends-on-GNU-coreutils.patch
    0001-Import-sleep-nearer-to-usage.patch
"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	cd "$builddir"
    default_prepare || return 1
}

build() {
	cd "$builddir"
	python2 setup.py build || return 1
	python3 setup.py build || return 1
}

check() {
    cd "$builddir"
    python2 setup.py test || return 1
    # Broken on our current Python build due to setuptools version conflict
    #python3 setup.py test || return 1
}

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

_py() {
	local python="$1"
	pkgdesc="$pkgdesc ${python:6:1}"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"
}

_py2() {
	_py python2
}

_py3() {
	_py python3
}

sha512sums="fff1946466e109bf020a6dbaca7e99b992c0335bc4b380224e981b2e0690a5ef465fdd95ee9473bdc0f0381897c5314cee715c600708d02892e0a109e5b9dbbe  tqdm-4.19.5.tar.gz
3e94642970da68ec422f78ba8aa080832ab3b2d2cb66b137d79dccd71921d0bb8796f97828b1eedd5751502a816bbd6a6d66fae238bd9a6fbc46c58f93d69636  0001-Skip-flaky-test-that-depends-on-GNU-coreutils.patch
4d6b06028a8d8c4214dc57168fa50ccd19fea79b7099d5d695bf00a6e8f01ece76341dc992ce8bfb513140f3b425d29e428842a8ade417d758bf4c67474d65d0  0001-Import-sleep-nearer-to-usage.patch"
-- 
2.15.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)