How to run test suite in python setup.py

隐身守侯 提交于 2019-12-23 07:40:09

问题


I am trying to setup a Python package using setup.py. My directory structure looks like this:

setup.py
baxter/
  __init__.py
  baxter.py
tests/
  test_baxter.py

Here is setup.py:

from setuptools import setup, find_packages
setup(name='baxter',
      version='1.0',
      packages=find_packages()
      )

I first do a python setup.py build. When I then run python setup.py test I immediately get this result:

running test

and nothing else. The unit tests have not run since the tests take at least 15 seconds to finish and the message running test comes back right away.

So it appears that python setup.py test is not finding the unit tests. What am I doing wrong?


回答1:


Pretty simple, add the following to your setup() call:

test_suite="tests",   


来源:https://stackoverflow.com/questions/20941880/how-to-run-test-suite-in-python-setup-py

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!