简体   繁体   English

如何在python setup.py中运行测试套件

[英]How to run test suite in python setup.py

I am trying to setup a Python package using setup.py . 我正在尝试使用setup.py设置Python包。 My directory structure looks like this: 我的目录结构如下所示:

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

Here is setup.py : 这是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 . 我首先做一个python setup.py build When I then run python setup.py test I immediately get this result: 当我运行python setup.py test我立即得到这个结果:

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. 单元测试没有运行,因为测试需要至少15秒才能完成,并且消息running test会立即恢复。

So it appears that python setup.py test is not finding the unit tests. 所以似乎python setup.py test没有找到单元测试。 What am I doing wrong? 我究竟做错了什么?

非常简单,将以下内容添加到您的setup()调用中:

test_suite="tests",   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM