Should Python unittests be in a separate module?

后端 未结 7 2005
攒了一身酷
攒了一身酷 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:14

    Personally, I create a tests/ folder in my source directory and try to, more or less, mirror my main source code hierarchy with unit test equivalents (having 1 module = 1 unit test module as a rule of thumb).

    Note that I'm using nose and its philosophy is a bit different than unittest's.

提交回复
热议问题