Extract child flush as a staticmethod
This commit is contained in:
parent
82fb63ca2d
commit
11ec96a927
|
@ -76,6 +76,10 @@ 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 child.isalive():
|
||||
child.wait()
|
||||
|
||||
|
@ -95,8 +99,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 +114,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 +132,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 +144,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 +156,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 +176,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 +191,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 +206,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 +225,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 +244,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 +270,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("""
|
||||
|
@ -331,8 +324,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