如何在python setup.py中运行测试套件 [英] How to run test suite in python setup.py

查看:261
本文介绍了如何在python setup.py中运行测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用setup.py设置Python软件包.我的目录结构如下:

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

这里是setup.py:

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

我首先要做一个python setup.py build.然后,当我运行python setup.py test时,我会立即得到以下结果:

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

running test

,仅此而已.单元测试未运行,因为测试至少需要15秒钟才能完成,并且消息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.

因此,看来python setup.py test找不到单元测试.我在做什么错了?

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

推荐答案

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

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

test_suite="tests",   

这篇关于如何在python setup.py中运行测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆