summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Delaney <idella4@gentoo.org>2013-06-05 19:18:34 +0000
committerIan Delaney <idella4@gentoo.org>2013-06-05 19:18:34 +0000
commitc8347123d70d3ac5a49c9018b595f2f669f0d653 (patch)
treee338ceaa0a415f52b055bc22b6176279ead2b89e /dev-python/envoy
parentVersion bump. (diff)
downloadgentoo-2-c8347123d70d3ac5a49c9018b595f2f669f0d653.tar.gz
gentoo-2-c8347123d70d3ac5a49c9018b595f2f669f0d653.tar.bz2
gentoo-2-c8347123d70d3ac5a49c9018b595f2f669f0d653.zip
revbump, migrate -> distutils-r1
(Portage version: 2.1.11.63/cvs/Linux x86_64, signed Manifest commit with key 0xB8072B0D)
Diffstat (limited to 'dev-python/envoy')
-rw-r--r--dev-python/envoy/ChangeLog11
-rw-r--r--dev-python/envoy/envoy-0.0.2-r1.ebuild32
-rw-r--r--dev-python/envoy/files/test_envoy.py52
3 files changed, 92 insertions, 3 deletions
diff --git a/dev-python/envoy/ChangeLog b/dev-python/envoy/ChangeLog
index dfb829ba16ed..7ff31bbebb04 100644
--- a/dev-python/envoy/ChangeLog
+++ b/dev-python/envoy/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for dev-python/envoy
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/envoy/ChangeLog,v 1.2 2012/01/15 19:14:25 tove Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/envoy/ChangeLog,v 1.3 2013/06/05 19:18:34 idella4 Exp $
+
+*envoy-0.0.2-r1 (05 Jun 2013)
+
+ 05 Jun 2013; Ian Delaney <idella4@gentoo.org> +envoy-0.0.2-r1.ebuild,
+ +files/test_envoy.py:
+ revbump, migrate -> distutils-r1
15 Jan 2012; Torsten Veller <tove@gentoo.org> envoy-0.0.2.ebuild:
Fix cvs keyword in the header (#398773)
@@ -10,4 +16,3 @@
30 Dec 2011; Patrick Lauer <patrick@gentoo.org> +envoy-0.0.2.ebuild,
+metadata.xml:
Initial import for #396287, ebuild by jbergstroem
-
diff --git a/dev-python/envoy/envoy-0.0.2-r1.ebuild b/dev-python/envoy/envoy-0.0.2-r1.ebuild
new file mode 100644
index 000000000000..5fca58ab0b1b
--- /dev/null
+++ b/dev-python/envoy/envoy-0.0.2-r1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/envoy/envoy-0.0.2-r1.ebuild,v 1.1 2013/06/05 19:18:34 idella4 Exp $
+
+EAPI=5
+PYTHON_COMPAT=( python{2_5,2_6,2_7} pypy2_0 )
+
+inherit distutils-r1
+
+DESCRIPTION="Simple API for running external processes"
+HOMEPAGE="https://github.com/kennethreitz/envoy http://pypi.python.org/pypi/envoy"
+SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+DEPEND="dev-python/setuptools"
+RDEPEND=""
+
+# Upstream forgot test_envoy.py in manifest. https://github.com/kennethreitz/envoy/pull/11
+# that was a year ago
+python_prepare_all() {
+ cp -r "${FILESDIR}"/test_envoy.py . || die
+ distutils-r1_python_prepare_all
+}
+
+python_test() {
+ # and it fails almost all;https://github.com/kennethreitz/envoy/issues/58
+ "${PYTHON}" test_envoy.py
+}
diff --git a/dev-python/envoy/files/test_envoy.py b/dev-python/envoy/files/test_envoy.py
new file mode 100644
index 000000000000..8c83a0816a27
--- /dev/null
+++ b/dev-python/envoy/files/test_envoy.py
@@ -0,0 +1,52 @@
+import unittest
+import envoy
+import time
+
+class SimpleTest(unittest.TestCase):
+
+ def test_input(self):
+ r = envoy.run("sed s/i/I/g", "Hi")
+ self.assertEqual(r.std_out.rstrip(), "HI")
+ self.assertEqual(r.status_code, 0)
+
+ def test_pipe(self):
+ r = envoy.run("echo -n 'hi'| tr [:lower:] [:upper:]")
+ self.assertEqual(r.std_out, "HI")
+ self.assertEqual(r.status_code, 0)
+
+ def test_timeout(self):
+ r = envoy.run('yes | head', timeout=1)
+ self.assertEqual(r.std_out, 'y\ny\ny\ny\ny\ny\ny\ny\ny\ny\n')
+ self.assertEqual(r.status_code, 0)
+
+ # THIS TEST FAILS BECAUSE expand_args DOESN'T HANDLE QUOTES PROPERLY
+ def test_quoted_args(self):
+ sentinel = 'quoted_args' * 3
+ r = envoy.run("python -c 'print \"%s\"'" % sentinel)
+ self.assertEqual(r.std_out.rstrip(), sentinel)
+ self.assertEqual(r.status_code, 0)
+
+class ConnectedCommandTests(unittest.TestCase):
+
+ def test_status_code_none(self):
+ c = envoy.connect("sleep 5")
+ self.assertEqual(c.status_code, None)
+
+ def test_status_code_success(self):
+ c = envoy.connect("sleep 1")
+ time.sleep(2)
+ self.assertEqual(c.status_code, 0)
+
+ def test_status_code_failure(self):
+ c = envoy.connect("sleeep 1")
+ self.assertEqual(c.status_code, 127)
+
+ def test_input(self):
+ test_string = 'asdfQWER'
+ r = envoy.connect("cat | tr [:lower:] [:upper:]")
+ r.send(test_string)
+ self.assertEqual(r.std_out, test_string.upper())
+ self.assertEqual(r.status_code, 0)
+
+if __name__ == "__main__":
+ unittest.main()