How to supply stdin, files and environment variable inputs to Python unit tests?
问题 How to write tests where conditions like the following arise: Test user Input. Test input read from a file. Test input read from an environment variable. It\'d be great if someone could show me how to approach the above mentioned scenarios; it\'d still be awesome if you could point me to a few docs/articles/blog posts which I could read. 回答1: All three situations you've described are where you need to specifically go out of your way to ensure you are using loose coupling in your design. Do