bpo-42722: Add --debug command line option to unittest to enable post-mortem debugging by Dominik1123 · Pull Request #23900 · python/cpython
On Github on my cpython fork: Fetch Upstream (and merge). Pull my fork to local with Github GUI.
On latop check cpython branch is main
sudo make clean # twice
./configure --with-pydebug
make -s
sudo make altinstall
I check which code has been changed; so for C code I will recompile from scratch on the PR branch, but in this case as only the py code has changed I will only do a gh pull and then test.
gh pr checkout 23900
Check terminal prompt shows correct branch such as:
cpython on resolve-42722 [$?] via s v3.11.0a3+>
Basically I follow the dev guide on https://devguide.python.org/.
OK so I tried again with the last param as --debug and the output is:
./python ../TestGeneric/main.py --debug
101
102
Traceback (most recent call last):
File "/home/me/Documents/cpython/../TestGeneric/main.py", line 15, in
unittest.main()
^^^^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/main.py", line 103, in init
self.runTests()
^^^^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/main.py", line 276, in runTests
testRunner.debug(self.test)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/runner.py", line 16, in debug
test.debug()
^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/suite.py", line 138, in debug
self.run(debug, True)
^^^^^^^^^^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/suite.py", line 124, in run
test.debug()
^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/suite.py", line 138, in debug
self.run(debug, True)
^^^^^^^^^^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/suite.py", line 124, in run
test.debug()
^^^^^^^^^^^^
File "/home/me/Documents/cpython/Lib/unittest/case.py", line 657, in debug
getattr(self, self._testMethodName)()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/Documents/cpython/../TestGeneric/main.py", line 11, in test_foo
self.assertIs(foo(), None)
^^^^^
File "/home/me/Documents/cpython/../TestGeneric/main.py", line 6, in foo
print(x + 100)
~~^~~~~
TypeError: can only concatenate str (not "int") to str
cpython on resolve-42722 [$?] via 🐍 v3.11.0a5+
Finally, yes the bpo.