The output of test_01 case in Unittest will be displayed in the HTML report. Before, some students asked me how to display the case to the terminal. Although I did not know what to do, I still gave the solution. This requires calling the shell command:

os.system('''python -c "open('./tmp.txt','w').write(raw_input('please: '))"''')
os.system('''python -c "print open('./tmp.txt','r').read()"''')
Copy the code

If you don’t want to use temporary configuration files, you can queue them, or you can block buffers and redirect outputs