(self)
| 4111 | self.assertEqual(pdb.Pdb().rcLines, ["invalid"]) |
| 4112 | |
| 4113 | def test_header(self): |
| 4114 | stdout = StringIO() |
| 4115 | header = 'Nobody expects... blah, blah, blah' |
| 4116 | with ExitStack() as resources: |
| 4117 | resources.enter_context(patch('sys.stdout', stdout)) |
| 4118 | # patch pdb.Pdb.set_trace() to avoid entering the debugger |
| 4119 | resources.enter_context(patch.object(pdb.Pdb, 'set_trace')) |
| 4120 | # We need to manually clear pdb.Pdb._last_pdb_instance so a |
| 4121 | # new instance with stdout redirected could be created when |
| 4122 | # pdb.set_trace() is called. |
| 4123 | pdb.Pdb._last_pdb_instance = None |
| 4124 | pdb.set_trace(header=header) |
| 4125 | self.assertEqual(stdout.getvalue(), header + '\n') |
| 4126 | |
| 4127 | def test_run_module(self): |
| 4128 | script = """print("SUCCESS")""" |
nothing calls this directly
no test coverage detected