Skip to content

Commit f36f9d2

Browse files
committed
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.
1 parent 4b164d9 commit f36f9d2

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

testing/test_pdb.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_1():
147147
child = testdir.spawn_pytest("--pdb %s" % p1)
148148
child.expect(".*def test_1")
149149
child.expect(".*i = 0")
150-
child.expect("(Pdb)")
150+
child.expect("Pdb")
151151
child.sendeof()
152152
rest = child.read().decode("utf8")
153153
assert "1 failed" in rest
@@ -174,7 +174,7 @@ def test_false(self):
174174
"""
175175
)
176176
child = testdir.spawn_pytest("--pdb %s" % p1)
177-
child.expect("(Pdb)")
177+
child.expect("Pdb")
178178
child.sendline("p self.filename")
179179
child.sendeof()
180180
rest = child.read().decode("utf8")
@@ -209,7 +209,7 @@ def test_1():
209209
child = testdir.spawn_pytest("--pdb %s" % p1)
210210
child.expect("captured stdout")
211211
child.expect("get rekt")
212-
child.expect("(Pdb)")
212+
child.expect("Pdb")
213213
child.sendeof()
214214
rest = child.read().decode("utf8")
215215
assert "1 failed" in rest
@@ -228,7 +228,7 @@ def test_1():
228228
child = testdir.spawn_pytest("--pdb %s" % p1)
229229
child.expect("captured stderr")
230230
child.expect("get rekt")
231-
child.expect("(Pdb)")
231+
child.expect("Pdb")
232232
child.sendeof()
233233
rest = child.read().decode("utf8")
234234
assert "1 failed" in rest
@@ -243,7 +243,7 @@ def test_1():
243243
"""
244244
)
245245
child = testdir.spawn_pytest("--pdb %s" % p1)
246-
child.expect("(Pdb)")
246+
child.expect("Pdb")
247247
output = child.before.decode("utf8")
248248
child.sendeof()
249249
assert "captured stdout" not in output
@@ -266,7 +266,7 @@ def test_1():
266266
if showcapture in ("all", "log"):
267267
child.expect("captured log")
268268
child.expect("get rekt")
269-
child.expect("(Pdb)")
269+
child.expect("Pdb")
270270
child.sendeof()
271271
rest = child.read().decode("utf8")
272272
assert "1 failed" in rest
@@ -287,7 +287,7 @@ def test_1():
287287
child.expect("get rekt")
288288
output = child.before.decode("utf8")
289289
assert "captured log" not in output
290-
child.expect("(Pdb)")
290+
child.expect("Pdb")
291291
child.sendeof()
292292
rest = child.read().decode("utf8")
293293
assert "1 failed" in rest
@@ -306,7 +306,7 @@ def test_1():
306306
child = testdir.spawn_pytest("--pdb %s" % p1)
307307
child.expect(".*def test_1")
308308
child.expect(".*pytest.raises.*globalfunc")
309-
child.expect("(Pdb)")
309+
child.expect("Pdb")
310310
child.sendline("globalfunc")
311311
child.expect(".*function")
312312
child.sendeof()
@@ -322,7 +322,7 @@ def test_pdb_interaction_on_collection_issue181(self, testdir):
322322
)
323323
child = testdir.spawn_pytest("--pdb %s" % p1)
324324
# child.expect(".*import pytest.*")
325-
child.expect("(Pdb)")
325+
child.expect("Pdb")
326326
child.sendeof()
327327
child.expect("1 error")
328328
self.flush(child)
@@ -337,7 +337,7 @@ def pytest_runtest_protocol():
337337
p1 = testdir.makepyfile("def test_func(): pass")
338338
child = testdir.spawn_pytest("--pdb %s" % p1)
339339
# child.expect(".*import pytest.*")
340-
child.expect("(Pdb)")
340+
child.expect("Pdb")
341341
child.sendeof()
342342
self.flush(child)
343343

@@ -355,7 +355,7 @@ def test_1():
355355
child = testdir.spawn_pytest(str(p1))
356356
child.expect("test_1")
357357
child.expect("x = 3")
358-
child.expect("(Pdb)")
358+
child.expect("Pdb")
359359
child.sendeof()
360360
rest = child.read().decode("utf-8")
361361
assert "1 failed" in rest
@@ -373,7 +373,7 @@ def test_1():
373373
)
374374
child = testdir.spawn_pytest(str(p1))
375375
child.expect("test_1")
376-
child.expect("(Pdb)")
376+
child.expect("Pdb")
377377
child.sendeof()
378378
rest = child.read().decode("utf8")
379379
assert "1 failed" in rest
@@ -448,10 +448,10 @@ def function_1():
448448
"""
449449
)
450450
child = testdir.spawn_pytest("--doctest-modules --pdb %s" % p1)
451-
child.expect("(Pdb)")
451+
child.expect("Pdb")
452452
child.sendline("i")
453453
child.expect("0")
454-
child.expect("(Pdb)")
454+
child.expect("Pdb")
455455
child.sendeof()
456456
rest = child.read().decode("utf8")
457457
assert "1 failed" in rest
@@ -474,7 +474,7 @@ def test_1():
474474
child = testdir.spawn_pytest(str(p1))
475475
child.expect("test_1")
476476
child.expect("x = 3")
477-
child.expect("(Pdb)")
477+
child.expect("Pdb")
478478
child.sendline("c")
479479
child.expect("x = 4")
480480
child.sendeof()
@@ -690,7 +690,7 @@ def test_1():
690690
)
691691
child = testdir.spawn_pytest(str(p1))
692692
child.expect("test_1")
693-
child.expect("(Pdb)")
693+
child.expect("Pdb")
694694
child.sendeof()
695695
rest = child.read().decode("utf8")
696696
assert "1 failed" in rest
@@ -710,7 +710,7 @@ def test_1():
710710
)
711711
child = testdir.spawn_pytest(str(p1))
712712
child.expect("test_1")
713-
child.expect("(Pdb)")
713+
child.expect("Pdb")
714714
child.sendeof()
715715
rest = child.read().decode("utf8")
716716
assert "1 failed" in rest
@@ -728,7 +728,7 @@ def test_1():
728728
)
729729
child = testdir.spawn_pytest("--trace " + str(p1))
730730
child.expect("test_1")
731-
child.expect("(Pdb)")
731+
child.expect("Pdb")
732732
child.sendeof()
733733
rest = child.read().decode("utf8")
734734
assert "1 passed" in rest
@@ -747,7 +747,7 @@ def test_1():
747747
)
748748
child = testdir.spawn_pytest("--trace " + str(p1))
749749
child.expect("is_equal")
750-
child.expect("(Pdb)")
750+
child.expect("Pdb")
751751
child.sendeof()
752752
rest = child.read().decode("utf8")
753753
assert "1 passed" in rest

0 commit comments

Comments
 (0)