Gentoo Archives: gentoo-commits

From: "Mike Gilbert (floppym)" <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/pytest/files: pytest-2.4.2-pexpect-3.0.patch
Date: Sat, 30 Nov 2013 03:50:58
Message-Id: 20131130035052.6611420035@flycatcher.gentoo.org
1 floppym 13/11/30 03:50:52
2
3 Added: pytest-2.4.2-pexpect-3.0.patch
4 Log:
5 Fix pexpect-3.0 problems in tests.
6
7 (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)
8
9 Revision Changes Path
10 1.1 dev-python/pytest/files/pytest-2.4.2-pexpect-3.0.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pytest/files/pytest-2.4.2-pexpect-3.0.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pytest/files/pytest-2.4.2-pexpect-3.0.patch?rev=1.1&content-type=text/plain
14
15 Index: pytest-2.4.2-pexpect-3.0.patch
16 ===================================================================
17 # HG changeset patch
18 # User holger krekel <holger@××××××××.eu>
19 # Date 1384852227 -3600
20 # Node ID 304f9f212ae373dbb55129b41b88e413baceba51
21 # Parent 77b0a734de063196acea35e63c0ece16078cd8f0
22 fix pexpect-3.0 compatibility for pytest's own tests.
23 (fixes issue386)
24
25 diff --git a/_pytest/pytester.py b/_pytest/pytester.py
26 --- a/_pytest/pytester.py
27 +++ b/_pytest/pytester.py
28 @@ -516,15 +516,16 @@
29 return self.spawn(cmd, expect_timeout=expect_timeout)
30
31 def spawn(self, cmd, expect_timeout=10.0):
32 - pexpect = py.test.importorskip("pexpect", "2.4")
33 + pexpect = py.test.importorskip("pexpect", "3.0")
34 if hasattr(sys, 'pypy_version_info') and '64' in py.std.platform.machine():
35 pytest.skip("pypy-64 bit not supported")
36 if sys.platform == "darwin":
37 pytest.xfail("pexpect does not work reliably on darwin?!")
38 if sys.platform.startswith("freebsd"):
39 pytest.xfail("pexpect does not work reliably on freebsd")
40 - logfile = self.tmpdir.join("spawn.out")
41 - child = pexpect.spawn(cmd, logfile=logfile.open("w"))
42 + logfile = self.tmpdir.join("spawn.out").open("wb")
43 + child = pexpect.spawn(cmd, logfile=logfile)
44 + self.request.addfinalizer(logfile.close)
45 child.timeout = expect_timeout
46 return child
47
48 diff --git a/testing/test_pdb.py b/testing/test_pdb.py
49 --- a/testing/test_pdb.py
50 +++ b/testing/test_pdb.py
51 @@ -62,7 +63,7 @@
52 child.expect(".*i = 0")
53 child.expect("(Pdb)")
54 child.sendeof()
55 - rest = child.read()
56 + rest = child.read().decode("utf8")
57 assert "1 failed" in rest
58 assert "def test_1" not in rest
59 if child.isalive():
60 @@ -127,7 +128,7 @@
61 child.expect("x = 3")
62 child.expect("(Pdb)")
63 child.sendeof()
64 - rest = child.read()
65 + rest = child.read().decode("utf-8")
66 assert "1 failed" in rest
67 assert "def test_1" in rest
68 assert "hello17" in rest # out is captured
69 @@ -144,7 +145,7 @@
70 child.expect("test_1")
71 child.expect("(Pdb)")
72 child.sendeof()
73 - rest = child.read()
74 + rest = child.read().decode("utf8")
75 assert "1 failed" in rest
76 assert "reading from stdin while output" not in rest
77 if child.isalive():
78 @@ -182,7 +183,7 @@
79 child.expect("0")
80 child.expect("(Pdb)")
81 child.sendeof()
82 - rest = child.read()
83 + rest = child.read().decode("utf8")
84 assert "1 failed" in rest
85 if child.isalive():
86 child.wait()
87 @@ -206,7 +207,7 @@
88 child.sendline('c')
89 child.expect("x = 4")
90 child.sendeof()
91 - rest = child.read()
92 + rest = child.read().decode("utf8")
93 assert "1 failed" in rest
94 assert "def test_1" in rest
95 assert "hello17" in rest # out is captured
96 @@ -238,6 +239,7 @@
97 child.expect("x = 5")
98 child.sendeof()
99 child.wait()
100 +
101 def test_pdb_collection_failure_is_shown(self, testdir):
102 p1 = testdir.makepyfile("""xxx """)
103 result = testdir.runpytest("--pdb", p1)
104 diff --git a/tox.ini b/tox.ini
105 --- a/tox.ini
106 +++ b/tox.ini
107 @@ -16,6 +16,7 @@
108 [testenv:py25]
109 setenv =
110 PIP_INSECURE=1
111 +deps=nose
112
113 [testenv:flakes]
114 changedir=
115 @@ -55,14 +56,6 @@
116 commands=py.test --doctest-modules _pytest
117 deps=
118
119 -[testenv:py32]
120 -deps=
121 - nose
122 -
123 -[testenv:py33]
124 -deps=
125 - nose
126 -
127 [testenv:doc]
128 basepython=python
129 changedir=doc/en