tests: fix/clarify expect for Pdb

`expect()` expects an regular expression, so "Pdb" is equivalent to
"(Pdb)".

But instead of escaping the parenthesis this patch removes them, to
allow for matching "(Pdb++)", too.
This commit is contained in:
Daniel Hahler 2018-10-10 20:48:20 +02:00
parent 4b164d947d
commit f36f9d2698
1 changed files with 19 additions and 19 deletions

View File

@ -147,7 +147,7 @@ class TestPDB(object):
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect(".*def test_1")
child.expect(".*i = 0")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -174,7 +174,7 @@ class TestPDB(object):
"""
)
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect("(Pdb)")
child.expect("Pdb")
child.sendline("p self.filename")
child.sendeof()
rest = child.read().decode("utf8")
@ -209,7 +209,7 @@ class TestPDB(object):
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect("captured stdout")
child.expect("get rekt")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -228,7 +228,7 @@ class TestPDB(object):
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect("captured stderr")
child.expect("get rekt")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -243,7 +243,7 @@ class TestPDB(object):
"""
)
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect("(Pdb)")
child.expect("Pdb")
output = child.before.decode("utf8")
child.sendeof()
assert "captured stdout" not in output
@ -266,7 +266,7 @@ class TestPDB(object):
if showcapture in ("all", "log"):
child.expect("captured log")
child.expect("get rekt")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -287,7 +287,7 @@ class TestPDB(object):
child.expect("get rekt")
output = child.before.decode("utf8")
assert "captured log" not in output
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -306,7 +306,7 @@ class TestPDB(object):
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect(".*def test_1")
child.expect(".*pytest.raises.*globalfunc")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendline("globalfunc")
child.expect(".*function")
child.sendeof()
@ -322,7 +322,7 @@ class TestPDB(object):
)
child = testdir.spawn_pytest("--pdb %s" % p1)
# child.expect(".*import pytest.*")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
child.expect("1 error")
self.flush(child)
@ -337,7 +337,7 @@ class TestPDB(object):
p1 = testdir.makepyfile("def test_func(): pass")
child = testdir.spawn_pytest("--pdb %s" % p1)
# child.expect(".*import pytest.*")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
self.flush(child)
@ -355,7 +355,7 @@ class TestPDB(object):
child = testdir.spawn_pytest(str(p1))
child.expect("test_1")
child.expect("x = 3")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf-8")
assert "1 failed" in rest
@ -373,7 +373,7 @@ class TestPDB(object):
)
child = testdir.spawn_pytest(str(p1))
child.expect("test_1")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -448,10 +448,10 @@ class TestPDB(object):
"""
)
child = testdir.spawn_pytest("--doctest-modules --pdb %s" % p1)
child.expect("(Pdb)")
child.expect("Pdb")
child.sendline("i")
child.expect("0")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -474,7 +474,7 @@ class TestPDB(object):
child = testdir.spawn_pytest(str(p1))
child.expect("test_1")
child.expect("x = 3")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendline("c")
child.expect("x = 4")
child.sendeof()
@ -690,7 +690,7 @@ class TestDebuggingBreakpoints(object):
)
child = testdir.spawn_pytest(str(p1))
child.expect("test_1")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -710,7 +710,7 @@ class TestDebuggingBreakpoints(object):
)
child = testdir.spawn_pytest(str(p1))
child.expect("test_1")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 failed" in rest
@ -728,7 +728,7 @@ class TestTraceOption:
)
child = testdir.spawn_pytest("--trace " + str(p1))
child.expect("test_1")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 passed" in rest
@ -747,7 +747,7 @@ class TestTraceOption:
)
child = testdir.spawn_pytest("--trace " + str(p1))
child.expect("is_equal")
child.expect("(Pdb)")
child.expect("Pdb")
child.sendeof()
rest = child.read().decode("utf8")
assert "1 passed" in rest