Meador Inge <[email protected]> added the comment:
Normally a test case is needed. I tried the following:
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
@@ -595,6 +595,25 @@ def test_pdb_run_with_code_object():
(Pdb) continue
"""
+def test_pdb_continue_in_thread():
+ """Testing the ability to continue from a non-main thread.
+
+ >>> import threading
+ >>>
+ >>> def start_pdb():
+ ... import pdb
+ ... pdb.Pdb().set_trace()
+ ... x = 1
+ ... y = 1
+ ...
+
+ >>> with PdbTestInput(['continue']):
+ ... t = threading.Thread(target=start_pdb)
+ ... t.start()
+ > <doctest test.test_pdb.test_pdb_continue_in_thread[1]>(4)start_pdb()
+ -> x = 1
+ (Pdb) continue
+"""
but 'doctests' doesn't seem to play nicely with threading. The pdb testsuite
fails with:
[meadori@motherbrain cpython]$ ./python -m test test_pdb
[1/1] test_pdb
**********************************************************************
File "/home/meadori/code/python/cpython/Lib/test/test_pdb.py", line 610, in
test.test_pdb.test_pdb_continue_in_thread
Failed example:
with PdbTestInput(['continue']):
t = threading.Thread(target=start_pdb)
t.start()
Expected:
> <doctest test.test_pdb.test_pdb_continue_in_thread[1]>(4)start_pdb()
-> x = 1
(Pdb) continue
Got nothing
**********************************************************************
File "/home/meadori/code/python/cpython/Lib/test/test_pdb.py", line 34, in
test.test_pdb.test_pdb_displayhook
Failed example:
def test_function(foo, bar):
import pdb; pdb.Pdb(nosigint=True).set_trace()
pass
Expected nothing
Got:
> <doctest test.test_pdb.test_pdb_continue_in_thread[1]>(4)start_pdb()
Exception in thread Thread-1:
It looks like the output is going to the wrong test.
Anyone else have test ideas? If not, then I guess it is OK to commit as is.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com