Testing Python Scripts

后端 未结 5 1451
小蘑菇
小蘑菇 2021-02-14 01:23

How do I test the STDOUT output of a Python script with a testing framework like doctest, unittest, nose, etc? For example, say running my script "todo.py --list" shou

5条回答
  •  青春惊慌失措
    2021-02-14 02:07

    I also might want to look at the TextTest testing framework. It focusses more on functional/acceptance testing (so is less amenable to unit testing) and relies heavily on a program's textual output. This way your habit becomes a good one :-).

提交回复
热议问题