1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/304f9f212ae3/
Changeset:   304f9f212ae3
User:        hpk42
Date:        2013-11-19 10:10:27
Summary:     fix pexpect-3.0 compatibility for pytest's own tests.
(fixes issue386)
Affected #:  4 files

diff -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 
304f9f212ae373dbb55129b41b88e413baceba51 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,9 @@
 Unreleased
 -----------------------------------
 
+- fix pexpect-3.0 compatibility for pytest's own tests.
+  (fixes issue386)
+
 - allow nested parametrize-value markers, thanks James Lan for the PR.
 
 - fix unicode handling with new monkeypatch.setattr(import_path, value)

diff -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 
304f9f212ae373dbb55129b41b88e413baceba51 _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 -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 
304f9f212ae373dbb55129b41b88e413baceba51 testing/test_pdb.py
--- a/testing/test_pdb.py
+++ b/testing/test_pdb.py
@@ -1,3 +1,4 @@
+
 import py
 import sys
 
@@ -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 -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 
304f9f212ae373dbb55129b41b88e413baceba51 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

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to