Should Python unittests be in a separate module?

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

    I generally keep test code in a separate module, and ship the module/package and tests in a single distribution. If the user installs using setup.py they can run the tests from the test directory to ensure that everything works in their environment, but only the module's code ends up under Lib/site-packages.

提交回复
热议问题