Create automated tests for interactive shell based on Python's cmd module
问题 I am building an interactive shell using Python 3 and the cmd module. I have already written simple unit tests using py.test to test the individual functions, such as the do_* functions. I'd like to create more comprehensive tests that actually interact with the shell itself by simulating a user's input. For example, how could I test the following simulated session: bash$ console-app.py md:> show options Available Options: ------------------ HOST The IP address or hostname of the machine to