Should Python unittests be in a separate module?

后端 未结 7 1997
攒了一身酷
攒了一身酷 2021-02-12 16:44

Is there a consensus about the best place to put Python unittests?

Should the unittests be included within the same module as the functionality being tested (executed wh

7条回答
  •  走了就别回头了
    2021-02-12 17:27

    I usually have them in a separate folder called most often test/. Personally I am not using the if __name__ == '__main__' check, because I use nosetests and it handles the test detection by itself.

提交回复
热议问题