gh-102980: Redirect pdb interact command, add tests and improve docs #111194
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
With the long due #102896, we can finally add tests for
interactcommand.However, the current
interactcommand usescode.interactdirectly which makes it super difficult to test, becausecode.interactwrites tosys.stderrdirectly (withsys.stderr.write)! We need to overload thewritemethod in a derived class to write to the same channel asPdb.message.The interactive message is also changed to make more sense - one might wonder if this is a breaking change to users, but
interactcommand, so I don't think we'll break anything.This PR adds the class for interact commmand and some basic tests for
interact; and also clarifies the namespace situation withinteract- it's a bit tricky and could be confusing to the users, so some clarification is needed.The way to exit
interactcommand is also added to the docs.📚 Documentation preview 📚: https://cpython-previews--111194.org.readthedocs.build/