Merge pull request #2024 from jaraco/issue-2022
Restore pexpect tests on macOS. Fixes #2022.
This commit is contained in:
commit
7f95ea31d5
|
@ -1002,8 +1002,6 @@ class Testdir:
|
|||
pexpect = pytest.importorskip("pexpect", "3.0")
|
||||
if hasattr(sys, 'pypy_version_info') and '64' in 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").open("wb")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import sys
|
||||
import platform
|
||||
|
||||
import _pytest._code
|
||||
import pytest
|
||||
|
@ -76,6 +77,12 @@ class TestPDB:
|
|||
rest = child.read().decode("utf8")
|
||||
assert "1 failed" in rest
|
||||
assert "def test_1" not in rest
|
||||
self.flush(child)
|
||||
|
||||
@staticmethod
|
||||
def flush(child):
|
||||
if platform.system() == 'Darwin':
|
||||
return
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
|
||||
|
@ -95,8 +102,7 @@ class TestPDB:
|
|||
child.sendeof()
|
||||
rest = child.read().decode("utf8")
|
||||
assert 'debug.me' in rest
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_interaction_capture(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -111,8 +117,7 @@ class TestPDB:
|
|||
rest = child.read().decode("utf8")
|
||||
assert "1 failed" in rest
|
||||
assert "getrekt" not in rest
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_interaction_exception(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -130,8 +135,7 @@ class TestPDB:
|
|||
child.expect(".*function")
|
||||
child.sendeof()
|
||||
child.expect("1 failed")
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_interaction_on_collection_issue181(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -143,8 +147,7 @@ class TestPDB:
|
|||
child.expect("(Pdb)")
|
||||
child.sendeof()
|
||||
child.expect("1 error")
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_interaction_on_internal_error(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
|
@ -156,8 +159,7 @@ class TestPDB:
|
|||
#child.expect(".*import pytest.*")
|
||||
child.expect("(Pdb)")
|
||||
child.sendeof()
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_interaction_capturing_simple(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -177,8 +179,7 @@ class TestPDB:
|
|||
assert "1 failed" in rest
|
||||
assert "def test_1" in rest
|
||||
assert "hello17" in rest # out is captured
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_set_trace_interception(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -193,8 +194,7 @@ class TestPDB:
|
|||
rest = child.read().decode("utf8")
|
||||
assert "1 failed" in rest
|
||||
assert "reading from stdin while output" not in rest
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_and_capsys(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -209,8 +209,7 @@ class TestPDB:
|
|||
child.expect("hello1")
|
||||
child.sendeof()
|
||||
child.read()
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_set_trace_capturing_afterwards(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -229,8 +228,7 @@ class TestPDB:
|
|||
child.expect("hello")
|
||||
child.sendeof()
|
||||
child.read()
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_interaction_doctest(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -249,8 +247,7 @@ class TestPDB:
|
|||
child.sendeof()
|
||||
rest = child.read().decode("utf8")
|
||||
assert "1 failed" in rest
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_interaction_capturing_twice(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -276,8 +273,7 @@ class TestPDB:
|
|||
assert "def test_1" in rest
|
||||
assert "hello17" in rest # out is captured
|
||||
assert "hello18" in rest # out is captured
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_used_outside_test(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -288,7 +284,7 @@ class TestPDB:
|
|||
child = testdir.spawn("%s %s" %(sys.executable, p1))
|
||||
child.expect("x = 5")
|
||||
child.sendeof()
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_used_in_generate_tests(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
|
@ -302,7 +298,7 @@ class TestPDB:
|
|||
child = testdir.spawn_pytest(str(p1))
|
||||
child.expect("x = 5")
|
||||
child.sendeof()
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_collection_failure_is_shown(self, testdir):
|
||||
p1 = testdir.makepyfile("""xxx """)
|
||||
|
@ -331,8 +327,7 @@ class TestPDB:
|
|||
child.expect("enter_pdb_hook")
|
||||
child.send('c\n')
|
||||
child.sendeof()
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
self.flush(child)
|
||||
|
||||
def test_pdb_custom_cls(self, testdir):
|
||||
called = []
|
||||
|
|
Loading…
Reference in New Issue