Skip to content
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

test_pdb fails #86080

Closed
sumagnadas mannequin opened this issue Oct 2, 2020 · 7 comments
Closed

test_pdb fails #86080

sumagnadas mannequin opened this issue Oct 2, 2020 · 7 comments
Labels
3.11 only security fixes tests Tests in the Lib/test dir

Comments

@sumagnadas
Copy link
Mannequin

sumagnadas mannequin commented Oct 2, 2020

BPO 41914
Nosy @terryjreedy, @rrhodes, @iritkatriel, @sumagnadas, @phaunt
PRs
  • bpo-41914: Fix issue running test_pdb inside GNU screen #28564
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-07-31.20:23:53.563>
    created_at = <Date 2020-10-02.20:39:35.980>
    labels = ['tests', '3.11']
    title = 'test_pdb fails'
    updated_at = <Date 2021-09-25.21:01:07.524>
    user = 'https://github.com/sumagnadas'

    bugs.python.org fields:

    activity = <Date 2021-09-25.21:01:07.524>
    actor = 'oliphaunt'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-07-31.20:23:53.563>
    closer = 'iritkatriel'
    components = ['Tests']
    creation = <Date 2020-10-02.20:39:35.980>
    creator = 'sumagnadas'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41914
    keywords = []
    message_count = 7.0
    messages = ['377835', '384072', '398662', '402166', '402584', '402622', '402647']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'trrhodes', 'iritkatriel', 'sumagnadas', 'oliphaunt']
    pr_nums = ['28564']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue41914'
    versions = ['Python 3.11']

    @sumagnadas
    Copy link
    Mannequin Author

    sumagnadas mannequin commented Oct 2, 2020

    I was thinking about contributing to cpython so i cloned it and followed the tests mentioned on devguide.python.org. When i ran my tests, it failed on two of them: test_pdb and test_ssl. test_ssl had an issue already as i found here. test_pdb failure was the one which i didn't find here. It failed with the following message:

    == CPython 3.10.0a0 (heads/master:a937ab45d6, Oct 3 2020, 00:16:29) [GCC 9.3.0]
    == Linux-5.4.0-48-generic-x86_64-with-glibc2.31 little-endian
    == cwd: /mnt/sda2/github/cpython/build/test_python_21809æ
    == CPU count: 4
    == encodings: locale=UTF-8, FS=utf-8
    0:00:00 load avg: 1.52 Run tests in parallel using 2 child processes
    0:00:06 load avg: 1.48 [1/1/1] test_pdb failed
    test_blocks_at_first_code_line (test.test_pdb.PdbTestCase) ... ok
    test_breakpoint (test.test_pdb.PdbTestCase) ... ok
    test_errors_in_command (test.test_pdb.PdbTestCase) ... FAIL
    test_find_function_empty_file (test.test_pdb.PdbTestCase) ... ok
    test_find_function_found (test.test_pdb.PdbTestCase) ... ok
    test_find_function_found_with_bom (test.test_pdb.PdbTestCase) ... ok
    test_find_function_found_with_encoding_cookie (test.test_pdb.PdbTestCase) ... ok
    test_header (test.test_pdb.PdbTestCase) ... ok
    test_issue13120 (test.test_pdb.PdbTestCase) ... ok
    test_issue13183 (test.test_pdb.PdbTestCase) ... ok
    test_issue16180 (test.test_pdb.PdbTestCase) ... ok
    test_issue36250 (test.test_pdb.PdbTestCase) ... ok
    test_issue7964 (test.test_pdb.PdbTestCase) ... ok
    test_module_is_run_as_main (test.test_pdb.PdbTestCase) ... ok
    test_module_without_a_main (test.test_pdb.PdbTestCase) ... ok
    test_readrc_homedir (test.test_pdb.PdbTestCase) ... ok
    test_readrc_kwarg (test.test_pdb.PdbTestCase) ... ok
    test_relative_imports (test.test_pdb.PdbTestCase) ... ok
    test_relative_imports_on_plain_module (test.test_pdb.PdbTestCase) ... ok
    test_run_module (test.test_pdb.PdbTestCase) ... ok
    test_run_pdb_with_pdb (test.test_pdb.PdbTestCase) ... ok
    test_list_commands (test.test_pdb)
    Doctest: test.test_pdb.test_list_commands ... ok
    test_next_until_return_at_return_event (test.test_pdb)
    Doctest: test.test_pdb.test_next_until_return_at_return_event ... ok
    test_pdb_basic_commands (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_basic_commands ... ok
    test_pdb_breakpoint_commands (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_breakpoint_commands ... ok
    test_pdb_continue_in_bottomframe (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_continue_in_bottomframe ... ok
    test_pdb_displayhook (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_displayhook ... ok
    test_pdb_issue_20766 (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_issue_20766 ... ok
    test_pdb_next_command_for_asyncgen (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_for_asyncgen ... ok
    test_pdb_next_command_for_coroutine (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_for_coroutine ... ok
    test_pdb_next_command_for_generator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_for_generator ... ok
    test_pdb_next_command_in_generator_for_loop (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_in_generator_for_loop ... ok
    test_pdb_next_command_subiterator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_subiterator ... ok
    test_pdb_return_command_for_coroutine (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_return_command_for_coroutine ... ok
    test_pdb_return_command_for_generator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_return_command_for_generator ... ok
    test_pdb_run_with_code_object (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_run_with_code_object ... ok
    test_pdb_run_with_incorrect_argument (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_run_with_incorrect_argument ... ok
    test_pdb_skip_modules (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_skip_modules ... ok
    test_pdb_skip_modules_with_callback (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_skip_modules_with_callback ... ok
    test_pdb_until_command_for_coroutine (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_until_command_for_coroutine ... ok
    test_pdb_until_command_for_generator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_until_command_for_generator ... ok
    test_pdb_whatis_command (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_whatis_command ... ok
    test_post_mortem (test.test_pdb)
    Doctest: test.test_pdb.test_post_mortem ... ok

    ======================================================================
    FAIL: test_errors_in_command (test.test_pdb.PdbTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/mnt/sda2/github/cpython/Lib/test/test_pdb.py", line 1650, in test_errors_in_command
        self.assertEqual(stdout.splitlines()[1:], [
    AssertionError: Lists differ: ['(Pd[283 chars]efined", 'LEAVING RECURSIVE DEBUGGER', '(Pdb) ', '\x1b[?1034h'] != ['(Pd[283 chars]efined", 'LEAVING RECURSIVE DEBUGGER', '(Pdb) ']

    First list contains 1 additional elements.
    First extra element 9:
    '\x1b[?1034h'

    ['(Pdb) *** SyntaxError: unexpected EOF while parsing',
    '(Pdb) ENTERING RECURSIVE DEBUGGER',
    '*** SyntaxError: unexpected EOF while parsing',
    'LEAVING RECURSIVE DEBUGGER',
    '(Pdb) ENTERING RECURSIVE DEBUGGER',
    '> <string>(1)<module>()',
    "((Pdb)) *** NameError: name 'doesnotexist' is not defined",
    'LEAVING RECURSIVE DEBUGGER',

    • '(Pdb) ',
      ? ^

    + '(Pdb) ']
    ? ^

    • '\x1b[?1034h']

    ----------------------------------------------------------------------

    Ran 43 tests in 5.143s

    FAILED (failures=1)
    test test_pdb failed

    == Tests result: FAILURE ==

    1 test failed:
    test_pdb

    Total duration: 6.8 sec
    Tests result: FAILURE

    Is this happening only with me?

    @sumagnadas sumagnadas mannequin added 3.10 only security fixes tests Tests in the Lib/test dir labels Oct 2, 2020
    @sumagnadas sumagnadas mannequin changed the title test_pdb fails wit test_pdb fails Oct 2, 2020
    @sumagnadas sumagnadas mannequin changed the title test_pdb fails wit test_pdb fails Oct 2, 2020
    @rrhodes
    Copy link
    Mannequin

    rrhodes mannequin commented Dec 30, 2020

    Hi Sumagna,

    test_pdb appears to be working as expected on my machine. I realise this was posted a few months ago so would you mind trying again and seeing if the issue persists? If so, which OS are you running your tests on?

    @iritkatriel
    Copy link
    Member

    Sumagna,

    Thanks for the report. The test is passing on our buildbots, so this is not a general problem with it.

    It is hard to do anything about this without information about the platform and environment on which you saw the failure. If you are still seeing it, please create a new issue and include these details.

    @phaunt
    Copy link
    Mannequin

    phaunt mannequin commented Sep 19, 2021

    Re-opened as bpo-45242 (also identified the culprit)

    @terryjreedy
    Copy link
    Member

    terryjreedy commented Sep 24, 2021

    Léon's message from bpo-45242, which I closed as a duplicate of this.

    Leon: please try with 3.11 (best, repository main), 3.10, or at least 3.9. 3.8 and before only get security fixes.
    ---

    Building Python 3.7, I ran into the same issue reported [here] (only line numbers differ):

    \======================================================================
    FAIL: test_errors_in_command (__main__.PdbTestCase)
    \----------------------------------------------------------------------
    ```pytb
    Traceback (most recent call last):
      File "Lib/test/test_pdb.py", line 1535, in test_errors_in_command
        '(Pdb) ',
    AssertionError: Lists differ: ['(Pd[283 chars]efined", 'LEAVING RECURSIVE DEBUGGER', '(Pdb) ', '\x1b[?1034h'] != ['(Pd[283 chars]efined", 'LEAVING RECURSIVE DEBUGGER', '(Pdb) ']
    
    
    First list contains 1 additional elements.
    First extra element 9:
    '\\x1b[?1034h'
    
      ['(Pdb) *** SyntaxError: unexpected EOF while parsing',
       '(Pdb) ENTERING RECURSIVE DEBUGGER',
       '*** SyntaxError: unexpected EOF while parsing',
       'LEAVING RECURSIVE DEBUGGER',
       '(Pdb) ENTERING RECURSIVE DEBUGGER',
       '\> \<string\>(1)\<module\>()',
       "((Pdb)) *** NameError: name 'doesnotexist' is not defined",
       'LEAVING RECURSIVE DEBUGGER',
    -  '(Pdb) ',
    ?          ^
    
    \+  '(Pdb) ']
    ?          ^
    
    -  '\\x1b[?1034h']
    
    \----------------------------------------------------------------------
    Ran 39 tests in 1.024s
    
    FAILED (failures=1)
    

    I have also managed to determine the cause. As can be seen, the output from this pdb invocation contains an extraneous ANSI control sequence ("interpret "meta" key, set eighth bit"). This happens when running the test inside the GNU screen environment. Run the test outside screen, and the problem goes away.

    (By the way, this was the only test that failed when running make test inside the screen environment.)

    @phaunt
    Copy link
    Mannequin

    phaunt mannequin commented Sep 25, 2021

    Here's the issue again when running test_pdb.py for 3.11 (repository main). The same problem now occurs twice, and only inside the screen environment.

    ----- 8< -----

    ~/Temp/cpython> ./python Lib/test/test_pdb.py
    .....F.........F........................................
    ======================================================================
    FAIL: test_errors_in_command (main.PdbTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/leon/Temp/cpython/Lib/test/test_pdb.py", line 1847, in test_errors_in_command
        self.assertEqual(stdout.splitlines()[1:], [
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: Lists differ: ['-> [278 chars]efined", 'LEAVING RECURSIVE DEBUGGER', '(Pdb) ', '\x1b[?1034h'] != ['-> [278 chars]efined", 'LEAVING RECURSIVE DEBUGGER', '(Pdb) ']

    First list contains 1 additional elements.
    First extra element 10:
    '\x1b[?1034h'

    ['-> pass',
    "(Pdb) *** SyntaxError: '(' was never closed",
    '(Pdb) ENTERING RECURSIVE DEBUGGER',
    "*** SyntaxError: '(' was never closed",
    'LEAVING RECURSIVE DEBUGGER',
    '(Pdb) ENTERING RECURSIVE DEBUGGER',
    '> <string>(1)<module>()',
    "((Pdb)) *** NameError: name 'doesnotexist' is not defined",
    'LEAVING RECURSIVE DEBUGGER',

    • '(Pdb) ',
      ? ^

    + '(Pdb) ']
    ? ^

    • '\x1b[?1034h']

    ======================================================================
    FAIL: test_issue34266 (main.PdbTestCase)
    do_run handles exceptions from parsing its arg
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/leon/Temp/cpython/Lib/test/test_pdb.py", line 1875, in test_issue34266
        check('\\', 'No escaped character')
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/leon/Temp/cpython/Lib/test/test_pdb.py", line 1870, in check
        self.assertEqual(stdout.splitlines()[1:], [
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: Lists differ: ['-> [13 chars] *** Cannot run \\: No escaped character', '(Pdb) \x1b[?1034h'] != ['-> [13 chars] *** Cannot run \\: No escaped character', '(Pdb) ']

    First differing element 2:
    '(Pdb) \x1b[?1034h'
    '(Pdb) '

    - ['-> pass',
    -  '(Pdb) *** Cannot run \\: No escaped character',
    + ['-> pass', '(Pdb) *** Cannot run \\: No escaped character', '(Pdb) ']
    ? +++++++++++                                                 ++++++++++
    • '(Pdb) \x1b[?1034h']

    ----------------------------------------------------------------------
    Ran 56 tests in 2.850s

    FAILED (failures=2)

    @phaunt phaunt mannequin added 3.11 only security fixes and removed 3.10 only security fixes labels Sep 25, 2021
    @phaunt
    Copy link
    Mannequin

    phaunt mannequin commented Sep 25, 2021

    So I went ahead to fix the issue and created a PR. I also signed the CLA, but I understand that needs a little time to process.
    I was bold/forward enough to add myself to the ACKS. Please feel remove me if this contribution is too trivial.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants