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 in refleak mode #64945

Closed
pitrou opened this issue Feb 23, 2014 · 8 comments
Closed

test_pdb fails in refleak mode #64945

pitrou opened this issue Feb 23, 2014 · 8 comments
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Feb 23, 2014

BPO 20746
Nosy @birkenfeld, @pitrou, @vstinner, @xdegaye, @zware
Files
  • regrtest.diff
  • refleak_3.patch
  • 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 2014-08-12.01:43:00.527>
    created_at = <Date 2014-02-23.17:19:49.745>
    labels = ['tests', 'type-bug', 'library']
    title = 'test_pdb fails in refleak mode'
    updated_at = <Date 2014-08-12.01:43:00.509>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2014-08-12.01:43:00.509>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-08-12.01:43:00.527>
    closer = 'pitrou'
    components = ['Library (Lib)', 'Tests']
    creation = <Date 2014-02-23.17:19:49.745>
    creator = 'pitrou'
    dependencies = []
    files = ['34259', '36162']
    hgrepos = []
    issue_num = 20746
    keywords = ['patch']
    message_count = 8.0
    messages = ['212009', '212503', '212511', '213969', '224301', '224302', '225215', '225216']
    nosy_count = 6.0
    nosy_names = ['georg.brandl', 'pitrou', 'vstinner', 'xdegaye', 'python-dev', 'zach.ware']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue20746'
    versions = ['Python 3.4', 'Python 3.5']

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 23, 2014

    $ ./python -m test -W -R3:3 test_pdb
    [1/1] test_pdb
    [...]

    ======================================================================
    FAIL: test_list_commands (test.test_pdb)
    Doctest: test.test_pdb.test_list_commands
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_list_commands
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 288, in test_list_commands
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 311, in test.test_pdb.test_list_commands
    Failed example:
        with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
            'list',      # list first function
            'step',      # step into second function
            'list',      # list second function
            'list',      # continue listing to EOF
            'list 1,3',  # list specific lines
            'list x',    # invalid argument
            'next',      # step to import
            'next',      # step over import
            'step',      # step into do_nothing
            'longlist',  # list all lines
            'source do_something',  # list all lines of function
            'source fooxxx',        # something that doesn't exit
            'continue',
        ]):
           test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_list_commands[2]>", line 1, in <module>
            with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_next_until_return_at_return_event (test.test_pdb)
    Doctest: test.test_pdb.test_next_until_return_at_return_event
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_next_until_return_at_return_event
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 603, in test_next_until_return_at_return_event
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 617, in test.test_pdb.test_next_until_return_at_return_event
    Failed example:
        with PdbTestInput(['break test_function_2',
                           'continue',
                           'return',
                           'next',
                           'continue',
                           'return',
                           'until',
                           'continue',
                           'return',
                           'return',
                           'continue']):
            test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_next_until_return_at_return_event[2]>", line 1, in <module>
            with PdbTestInput(['break test_function_2',
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_basic_commands (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_basic_commands
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_basic_commands
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 62, in test_pdb_basic_commands
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 81, in test.test_pdb.test_pdb_basic_commands
    Failed example:
        with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
            'step',       # entering the function call
            'args',       # display function args
            'list',       # list function source
            'bt',         # display backtrace
            'up',         # step up to test_function()
            'down',       # step down to test_function_2() again
            'next',       # stepping to print(foo)
            'next',       # stepping to the for loop
            'step',       # stepping into the for loop
            'until',      # continuing until out of the for loop
            'next',       # executing the print(bar)
            'jump 8',     # jump over second for loop
            'return',     # return out of function
            'retval',     # display return value
            'continue',
        ]):
           test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_basic_commands[2]>", line 1, in <module>
            with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_breakpoint_commands (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_breakpoint_commands
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_breakpoint_commands
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 172, in test_pdb_breakpoint_commands
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 194, in test.test_pdb.test_pdb_breakpoint_commands
    Failed example:
        with PdbTestInput([  # doctest: +NORMALIZE_WHITESPACE
            'break 3',
            'disable 1',
            'ignore 1 10',
            'condition 1 1 < 2',
            'break 4',
            'break 4',
            'break',
            'clear 3',
            'break',
            'condition 1',
            'enable 1',
            'clear 1',
            'commands 2',
            'p "42"',
            'print("42", 7*6)',     # Issue 18764 (not about breakpoints)
            'end',
            'continue',  # will stop at breakpoint 2 (line 4)
            'clear',     # clear all!
            'y',
            'tbreak 5',
            'continue',  # will stop at temporary breakpoint
            'break',     # make sure breakpoint is gone
            'continue',
        ]):
           test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_breakpoint_commands[5]>", line 1, in <module>
            with PdbTestInput([  # doctest: +NORMALIZE_WHITESPACE
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_continue_in_bottomframe (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_continue_in_bottomframe
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_continue_in_bottomframe
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 517, in test_pdb_continue_in_bottomframe
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 529, in test.test_pdb.test_pdb_continue_in_bottomframe
    Failed example:
        with PdbTestInput([  # doctest: +ELLIPSIS
            'next',
            'break 7',
            'continue',
            'next',
            'continue',
            'continue',
        ]):
           test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_continue_in_bottomframe[1]>", line 1, in <module>
            with PdbTestInput([  # doctest: +ELLIPSIS
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_displayhook (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_displayhook
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_displayhook
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 33, in test_pdb_displayhook
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 40, in test.test_pdb.test_pdb_displayhook
    Failed example:
        with PdbTestInput([
            'foo',
            'bar',
            'for i in range(5): print(i)',
            'continue',
        ]):
            test_function(1, None)
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_displayhook[1]>", line 1, in <module>
            with PdbTestInput([
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_next_command_for_generator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_for_generator
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_next_command_for_generator
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 666, in test_pdb_next_command_for_generator
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 684, in test.test_pdb.test_pdb_next_command_for_generator
    Failed example:
        with PdbTestInput(['step',
                           'step',
                           'step',
                           'next',
                           'next',
                           'step',
                           'step',
                           'continue']):
            test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_next_command_for_generator[2]>", line 1, in <module>
            with PdbTestInput(['step',
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_next_command_in_generator_for_loop (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_in_generator_for_loop
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_next_command_in_generator_for_loop
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 820, in test_pdb_next_command_in_generator_for_loop
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 833, in test.test_pdb.test_pdb_next_command_in_generator_for_loop
    Failed example:
        with PdbTestInput(['break test_gen',
                           'continue',
                           'next',
                           'next',
                           'next',
                           'continue']):
            test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[2]>", line 1, in <module>
            with PdbTestInput(['break test_gen',
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_next_command_subiterator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_next_command_subiterator
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_next_command_subiterator
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 861, in test_pdb_next_command_subiterator
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 878, in test.test_pdb.test_pdb_next_command_subiterator
    Failed example:
        with PdbTestInput(['step',
                           'step',
                           'next',
                           'next',
                           'next',
                           'continue']):
            test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_next_command_subiterator[3]>", line 1, in <module>
            with PdbTestInput(['step',
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_return_command_for_generator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_return_command_for_generator
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_return_command_for_generator
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 723, in test_pdb_return_command_for_generator
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 742, in test.test_pdb.test_pdb_return_command_for_generator
    Failed example:
        with PdbTestInput(['step',
                           'step',
                           'step',
                           'return',
                           'step',
                           'step',
                           'continue']):
            test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_return_command_for_generator[2]>", line 1, in <module>
            with PdbTestInput(['step',
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_run_with_code_object (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_run_with_code_object
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_run_with_code_object
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 581, in test_pdb_run_with_code_object
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 584, in test.test_pdb.test_pdb_run_with_code_object
    Failed example:
        with PdbTestInput(['step','x', 'continue']):  # doctest: +ELLIPSIS
            pdb_invoke('run', compile('x=1', '<string>', 'exec'))
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_run_with_code_object[0]>", line 1, in <module>
            with PdbTestInput(['step','x', 'continue']):  # doctest: +ELLIPSIS
        NameError: name 'PdbTestInput' is not defined
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 594, in test.test_pdb.test_pdb_run_with_code_object
    Failed example:
        with PdbTestInput(['x', 'continue']):
            x=0
            pdb_invoke('runeval', compile('x+1', '<string>', 'eval'))
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_run_with_code_object[1]>", line 1, in <module>
            with PdbTestInput(['x', 'continue']):
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_run_with_incorrect_argument (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_run_with_incorrect_argument
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_run_with_incorrect_argument
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 565, in test_pdb_run_with_incorrect_argument
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 568, in test.test_pdb.test_pdb_run_with_incorrect_argument
    Failed example:
        pti = PdbTestInput(['continue',])
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_run_with_incorrect_argument[0]>", line 1, in <module>
            pti = PdbTestInput(['continue',])
        NameError: name 'PdbTestInput' is not defined
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 569, in test.test_pdb.test_pdb_run_with_incorrect_argument
    Failed example:
        with pti:
            pdb_invoke('run', lambda x: x)
    Expected:
        Traceback (most recent call last):
        TypeError: exec() arg 1 must be a string, bytes or code object
    Got:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_run_with_incorrect_argument[1]>", line 1, in <module>
            with pti:
        NameError: name 'pti' is not defined
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 574, in test.test_pdb.test_pdb_run_with_incorrect_argument
    Failed example:
        with pti:
            pdb_invoke('runeval', lambda x: x)
    Expected:
        Traceback (most recent call last):
        TypeError: eval() arg 1 must be a string, bytes or code object
    Got:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_run_with_incorrect_argument[2]>", line 1, in <module>
            with pti:
        NameError: name 'pti' is not defined

    ======================================================================
    FAIL: test_pdb_skip_modules (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_skip_modules
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_skip_modules
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 446, in test_pdb_skip_modules
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 454, in test.test_pdb.test_pdb_skip_modules
    Failed example:
        with PdbTestInput([
            'step',
            'continue',
        ]):
            skip_module()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_skip_modules[1]>", line 1, in <module>
            with PdbTestInput([
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_skip_modules_with_callback (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_skip_modules_with_callback
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_skip_modules_with_callback
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 474, in test_pdb_skip_modules_with_callback
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 483, in test.test_pdb.test_pdb_skip_modules_with_callback
    Failed example:
        with PdbTestInput([
            'step',
            'step',
            'step',
            'step',
            'step',
            'continue',
        ]):
            skip_module()
            pass  # provides something to "step" to
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_skip_modules_with_callback[1]>", line 1, in <module>
            with PdbTestInput([
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_pdb_until_command_for_generator (test.test_pdb)
    Doctest: test.test_pdb.test_pdb_until_command_for_generator
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_pdb_until_command_for_generator
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 776, in test_pdb_until_command_for_generator
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 791, in test.test_pdb.test_pdb_until_command_for_generator
    Failed example:
        with PdbTestInput(['step',
                           'until 4',
                           'step',
                           'step',
                           'continue']):
            test_function()
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_pdb_until_command_for_generator[2]>", line 1, in <module>
            with PdbTestInput(['step',
        NameError: name 'PdbTestInput' is not defined

    ======================================================================
    FAIL: test_post_mortem (test.test_pdb)
    Doctest: test.test_pdb.test_post_mortem
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/antoine/cpython/default/Lib/doctest.py", line 2193, in runTest
        raise self.failureException(self.format_failure(new.getvalue()))
    AssertionError: Failed doctest test for test.test_pdb.test_post_mortem
      File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 384, in test_post_mortem
    
    ----------------------------------------------------------------------
    File "/home/antoine/cpython/default/Lib/test/test_pdb.py", line 398, in test.test_pdb.test_post_mortem
    Failed example:
        with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
            'next',      # step over exception-raising call
            'bt',        # get a backtrace
            'list',      # list code of test_function()
            'down',      # step into test_function_2()
            'list',      # list code of test_function_2()
            'continue',
        ]):
           try:
               test_function()
           except ZeroDivisionError:
               print('Correctly reraised.')
    Exception raised:
        Traceback (most recent call last):
          File "/home/antoine/cpython/default/Lib/doctest.py", line 1324, in __run
            compileflags, 1), test.globs)
          File "<doctest test.test_pdb.test_post_mortem[2]>", line 1, in <module>
            with PdbTestInput([  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
        NameError: name 'PdbTestInput' is not defined

    @pitrou pitrou added stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Feb 23, 2014
    @xdegaye
    Copy link
    Mannequin

    xdegaye mannequin commented Mar 1, 2014

    The doctests are executed with 'test.globs' as globals which is set in the 'find' method of doctest.DocTestFinder, and cleared after each run (unless 'clear_globs' is false). One possible fix is to have test.regrtest 'find' a new test_runner before each run instead of always using the same one. This is what does the attached patch.

    @xdegaye
    Copy link
    Mannequin

    xdegaye mannequin commented Mar 1, 2014

    See also bpo-20766.

    @xdegaye
    Copy link
    Mannequin

    xdegaye mannequin commented Mar 18, 2014

    test_statistics also defines a load_tests() function that builds unittest tests from doctests with doctest.DocTestSuite() and also fails in refleak mode. The above regrtest.diff patch also fixes the test_statistics in refleak mode.

    @xdegaye
    Copy link
    Mannequin

    xdegaye mannequin commented Jul 30, 2014

    This is because breakpoints number are class attributes. With the following change, the "./python -m test test_pdb test_pdb" is ok:

    $ hg diff
    diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
    --- a/Lib/test/test_pdb.py
    +++ b/Lib/test/test_pdb.py
    @@ -614,6 +614,8 @@
         ...     test_function_2()
         ...     end = 1
     
    +    >>> from bdb import Breakpoint; Breakpoint.next = 1
    +
         >>> with PdbTestInput(['break test_function_2',
         ...                    'continue',
         ...                    'return',

    Attached refleak_3.patch fixes this problem for test_next_until_return_at_return_event().

    @xdegaye
    Copy link
    Mannequin

    xdegaye mannequin commented Jul 30, 2014

    Sorry, I posted to the wrong issue, please ignore my previous message.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 12, 2014

    New changeset df832e0c6d7d by Antoine Pitrou in branch '3.4':
    Issue bpo-20746: Fix test_pdb to run in refleak mode (-R). Patch by Xavier de Gaye.
    http://hg.python.org/cpython/rev/df832e0c6d7d

    New changeset d2041159e8ed by Antoine Pitrou in branch 'default':
    Issue bpo-20746: Fix test_pdb to run in refleak mode (-R). Patch by Xavier de Gaye.
    http://hg.python.org/cpython/rev/d2041159e8ed

    @pitrou
    Copy link
    Member Author

    pitrou commented Aug 12, 2014

    The regrtest.py part has been fixed independently in bpo-22104 (thank you Zachary). I've now pushed the rest of the patch for test_pdb. Thank you Xavier!

    @pitrou pitrou closed this as completed Aug 12, 2014
    @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
    stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant