summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2013-11-30 03:50:52 +0000
committerMike Gilbert <floppym@gentoo.org>2013-11-30 03:50:52 +0000
commit892bc06738e71e9c4514cda6884895847aebcfed (patch)
treef632d6d055d431dccfd258740060f248099d6b5f /dev-python/pytest
parentx86 stable wrt bug #488156 (diff)
downloadgentoo-2-892bc06738e71e9c4514cda6884895847aebcfed.tar.gz
gentoo-2-892bc06738e71e9c4514cda6884895847aebcfed.tar.bz2
gentoo-2-892bc06738e71e9c4514cda6884895847aebcfed.zip
Fix pexpect-3.0 problems in tests.
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)
Diffstat (limited to 'dev-python/pytest')
-rw-r--r--dev-python/pytest/ChangeLog6
-rw-r--r--dev-python/pytest/files/pytest-2.4.2-pexpect-3.0.patch113
-rw-r--r--dev-python/pytest/pytest-2.4.2.ebuild12
3 files changed, 124 insertions, 7 deletions
diff --git a/dev-python/pytest/ChangeLog b/dev-python/pytest/ChangeLog
index 5271980f0003..4b45b3efaca9 100644
--- a/dev-python/pytest/ChangeLog
+++ b/dev-python/pytest/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for dev-python/pytest
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/pytest/ChangeLog,v 1.81 2013/11/17 04:13:46 prometheanfire Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pytest/ChangeLog,v 1.82 2013/11/30 03:50:52 floppym Exp $
+
+ 30 Nov 2013; Mike Gilbert <floppym@gentoo.org>
+ +files/pytest-2.4.2-pexpect-3.0.patch, pytest-2.4.2.ebuild:
+ Fix pexpect-3.0 problems in tests.
17 Nov 2013; Matthew Thode <prometheanfire@gentoo.org> pytest-2.4.2.ebuild:
added pytest-2.4.2 with restricted tests due to upstream bug
diff --git a/dev-python/pytest/files/pytest-2.4.2-pexpect-3.0.patch b/dev-python/pytest/files/pytest-2.4.2-pexpect-3.0.patch
new file mode 100644
index 000000000000..ffdbd866211c
--- /dev/null
+++ b/dev-python/pytest/files/pytest-2.4.2-pexpect-3.0.patch
@@ -0,0 +1,113 @@
+# HG changeset patch
+# User holger krekel <holger@merlinux.eu>
+# Date 1384852227 -3600
+# Node ID 304f9f212ae373dbb55129b41b88e413baceba51
+# Parent 77b0a734de063196acea35e63c0ece16078cd8f0
+fix pexpect-3.0 compatibility for pytest's own tests.
+(fixes issue386)
+
+diff --git a/_pytest/pytester.py b/_pytest/pytester.py
+--- a/_pytest/pytester.py
++++ b/_pytest/pytester.py
+@@ -516,15 +516,16 @@
+ return self.spawn(cmd, expect_timeout=expect_timeout)
+
+ def spawn(self, cmd, expect_timeout=10.0):
+- pexpect = py.test.importorskip("pexpect", "2.4")
++ pexpect = py.test.importorskip("pexpect", "3.0")
+ if hasattr(sys, 'pypy_version_info') and '64' in py.std.platform.machine():
+ pytest.skip("pypy-64 bit not supported")
+ if sys.platform == "darwin":
+ pytest.xfail("pexpect does not work reliably on darwin?!")
+ if sys.platform.startswith("freebsd"):
+ pytest.xfail("pexpect does not work reliably on freebsd")
+- logfile = self.tmpdir.join("spawn.out")
+- child = pexpect.spawn(cmd, logfile=logfile.open("w"))
++ logfile = self.tmpdir.join("spawn.out").open("wb")
++ child = pexpect.spawn(cmd, logfile=logfile)
++ self.request.addfinalizer(logfile.close)
+ child.timeout = expect_timeout
+ return child
+
+diff --git a/testing/test_pdb.py b/testing/test_pdb.py
+--- a/testing/test_pdb.py
++++ b/testing/test_pdb.py
+@@ -62,7 +63,7 @@
+ child.expect(".*i = 0")
+ child.expect("(Pdb)")
+ child.sendeof()
+- rest = child.read()
++ rest = child.read().decode("utf8")
+ assert "1 failed" in rest
+ assert "def test_1" not in rest
+ if child.isalive():
+@@ -127,7 +128,7 @@
+ child.expect("x = 3")
+ child.expect("(Pdb)")
+ child.sendeof()
+- rest = child.read()
++ rest = child.read().decode("utf-8")
+ assert "1 failed" in rest
+ assert "def test_1" in rest
+ assert "hello17" in rest # out is captured
+@@ -144,7 +145,7 @@
+ child.expect("test_1")
+ child.expect("(Pdb)")
+ child.sendeof()
+- rest = child.read()
++ rest = child.read().decode("utf8")
+ assert "1 failed" in rest
+ assert "reading from stdin while output" not in rest
+ if child.isalive():
+@@ -182,7 +183,7 @@
+ child.expect("0")
+ child.expect("(Pdb)")
+ child.sendeof()
+- rest = child.read()
++ rest = child.read().decode("utf8")
+ assert "1 failed" in rest
+ if child.isalive():
+ child.wait()
+@@ -206,7 +207,7 @@
+ child.sendline('c')
+ child.expect("x = 4")
+ child.sendeof()
+- rest = child.read()
++ rest = child.read().decode("utf8")
+ assert "1 failed" in rest
+ assert "def test_1" in rest
+ assert "hello17" in rest # out is captured
+@@ -238,6 +239,7 @@
+ child.expect("x = 5")
+ child.sendeof()
+ child.wait()
++
+ def test_pdb_collection_failure_is_shown(self, testdir):
+ p1 = testdir.makepyfile("""xxx """)
+ result = testdir.runpytest("--pdb", p1)
+diff --git a/tox.ini b/tox.ini
+--- a/tox.ini
++++ b/tox.ini
+@@ -16,6 +16,7 @@
+ [testenv:py25]
+ setenv =
+ PIP_INSECURE=1
++deps=nose
+
+ [testenv:flakes]
+ changedir=
+@@ -55,14 +56,6 @@
+ commands=py.test --doctest-modules _pytest
+ deps=
+
+-[testenv:py32]
+-deps=
+- nose
+-
+-[testenv:py33]
+-deps=
+- nose
+-
+ [testenv:doc]
+ basepython=python
+ changedir=doc/en
diff --git a/dev-python/pytest/pytest-2.4.2.ebuild b/dev-python/pytest/pytest-2.4.2.ebuild
index 8100eeafa737..e65bd323ac96 100644
--- a/dev-python/pytest/pytest-2.4.2.ebuild
+++ b/dev-python/pytest/pytest-2.4.2.ebuild
@@ -1,16 +1,12 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/pytest/pytest-2.4.2.ebuild,v 1.3 2013/11/17 04:13:46 prometheanfire Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pytest/pytest-2.4.2.ebuild,v 1.4 2013/11/30 03:50:52 floppym Exp $
EAPI="5"
PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3} pypy2_0 )
inherit distutils-r1 eutils
-RESTRICT="test"
-#testing restricted due to test failures with pexpect-3.0 (which is required for pypy2_0 and python3_x support)
-#https://bitbucket.org/hpk42/pytest/issue/386/tests-fail-with-pexpect-30
-
DESCRIPTION="py.test: simple powerful testing with Python"
HOMEPAGE="http://pytest.org/ http://pypi.python.org/pypi/pytest"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
@@ -29,7 +25,11 @@ DEPEND="${RDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
virtual/python-argparse[${PYTHON_USEDEP}]
test? ( dev-python/pyyaml[${PYTHON_USEDEP}]
- dev-python/pexpect[${PYTHON_USEDEP}] )"
+ >=dev-python/pexpect-3.0[${PYTHON_USEDEP}] )"
+
+PATCHES=(
+ "${FILESDIR}/pytest-2.4.2-pexpect-3.0.patch"
+)
python_prepare_all() {
# Disable versioning of py.test script to avoid collision with