-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
bpo-41914: Fix issue running test_pdb inside GNU screen
#28564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1844,7 +1844,8 @@ def test_errors_in_command(self): | |
| ]) | ||
| stdout, _ = self.run_pdb_script('pass', commands + '\n') | ||
|
|
||
| self.assertEqual(stdout.splitlines()[1:], [ | ||
| stdout_lines = stdout.splitlines()[1:] | ||
| expected_lines = [ | ||
| '-> pass', | ||
| '(Pdb) *** SyntaxError: \'(\' was never closed', | ||
|
|
||
|
|
@@ -1857,7 +1858,9 @@ def test_errors_in_command(self): | |
| "((Pdb)) *** NameError: name 'doesnotexist' is not defined", | ||
| 'LEAVING RECURSIVE DEBUGGER', | ||
| '(Pdb) ', | ||
| ]) | ||
| ] | ||
| self.assertTrue(all(e == s for (e, s) in zip(stdout_lines, expected_lines))) | ||
| self.assertTrue(len(expected_lines) <= len(stdout_lines) <= len(expected_lines) + 1) | ||
|
|
||
| def test_issue34266(self): | ||
| '''do_run handles exceptions from parsing its arg''' | ||
|
|
@@ -1867,11 +1870,7 @@ def check(bad_arg, msg): | |
| 'q', | ||
| ]) | ||
| stdout, _ = self.run_pdb_script('pass', commands + '\n') | ||
| self.assertEqual(stdout.splitlines()[1:], [ | ||
| '-> pass', | ||
| f'(Pdb) *** Cannot run {bad_arg}: {msg}', | ||
| '(Pdb) ', | ||
| ]) | ||
| self.assertIn(f'(Pdb) *** Cannot run {bad_arg}: {msg}', stdout) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason to remove the other expected lines? |
||
| check('\\', 'No escaped character') | ||
| check('"', 'No closing quotation') | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Fix issue running test_pdb inside GNU `screen`: for some reason, two tests | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd remove everything after the first colon, NEWS entries just need to say what the change is, not a detailed motivation. |
||
| in test_pdb failed when running inside GNU `screen`. The `screen` | ||
| environment injects an ANSI control sequence into the output from `pdb`, | ||
| which did not match the expected output. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use a comment explaining why we aren't checking for an exact match.
Also, the use of assertTrue means we won't get a detailed error if the test fails. Perhaps you could loop over the pairs of lines and
self.assertEqualfor each line instead.