This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_pdb fails in refleak mode
Type: behavior Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, pitrou, python-dev, vstinner, xdegaye, zach.ware
Priority: high Keywords: patch

Created on 2014-02-23 17:19 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
regrtest.diff xdegaye, 2014-03-01 15:04 review
refleak_3.patch xdegaye, 2014-07-30 12:31 review
Messages (8)
msg212009 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-23 17:19
$ ./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
msg212503 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2014-03-01 15:04
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.
msg212511 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2014-03-01 16:07
See also issue 20766.
msg213969 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2014-03-18 14:27
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.
msg224301 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2014-07-30 12:31
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().
msg224302 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2014-07-30 12:34
Sorry, I posted to the wrong issue, please ignore my previous message.
msg225215 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-12 01:41
New changeset df832e0c6d7d by Antoine Pitrou in branch '3.4':
Issue #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 #20746: Fix test_pdb to run in refleak mode (-R).  Patch by Xavier de Gaye.
http://hg.python.org/cpython/rev/d2041159e8ed
msg225216 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-08-12 01:43
The regrtest.py part has been fixed independently in #22104 (thank you Zachary). I've now pushed the rest of the patch for test_pdb. Thank you Xavier!
History
Date User Action Args
2022-04-11 14:57:59adminsetgithub: 64945
2014-08-12 01:43:00pitrousetstatus: open -> closed

versions: + Python 3.5, - Python 3.3
nosy: + zach.ware

messages: + msg225216
resolution: fixed
stage: needs patch -> resolved
2014-08-12 01:41:56python-devsetnosy: + python-dev
messages: + msg225215
2014-07-30 12:34:16xdegayesetmessages: + msg224302
2014-07-30 12:31:45xdegayesetfiles: + refleak_3.patch

messages: + msg224301
2014-07-28 22:43:51vstinnersetnosy: + vstinner
2014-03-18 14:27:25xdegayesetmessages: + msg213969
2014-03-01 16:07:23xdegayesetmessages: + msg212511
2014-03-01 15:04:13xdegayesetfiles: + regrtest.diff

nosy: + xdegaye
messages: + msg212503

keywords: + patch
2014-02-23 17:19:49pitroucreate