一起运行独立的鼻子测试套件
multisuite的Python项目详细描述
作为一个整体运行独立的鼻子测试套件。这特别有用, 如果您的套房有不同的包装要求。
安装
与其他python工具相比,将multisuite放在 virtualenvs,因为它的任务是为您的测试管理virtualenvs。你可以 仍然使用pip将其安装到系统中,但是:
$ sudo pip install multisuite
如果这不是您想要的,您可以简单地下载multisuite.py 来自the repository的文件。是一个文件 当前包含运行multisuite所需的所有内容。
教程
假设您有两个测试套件,每个套件都有一组需求。一个 包含0.1.1版和其他版本中的MONK 在0.1.2版中。因此,不可能在 同样的虚拟现实。为不同的测试手动创建不同的虚拟机 如果你有两个以上这样的套房,套房会变得相当复杂。 因此您决定使用multisuite。
您的套房如下:
root/ suite_1/ __init__.py requirements.txt # contains monk_tf==0.1.1 suite.py suite_2/ __init__.py requirements.txt # contains monk_tf==0.1.2 suite.py
这里的顺序很重要。每个套件可以包含任意数量的文件, 但它至少需要包含这三个文件。那requirements.txt 文件包含此套件所需的要求和suite.py文件 包含测试用例(或对它们的引用)。它需要包含 __init__.py文件,因为nosetests就是这样识别它们的。
如果您想确保您有一个正确的套件,可以创建它们 还有多套件:
$ multisuite makesuite suite_1 suite_2
您可以检查多套件是否可以找到您的测试套件:
$ multisuite list suite_1 suite_2
如果此处未列出套件,则无法正确检测到该套件。请再检查一遍 如果满足所有要求。现在您可以自己运行测试套件:
$ multisuite test suite_1 suite_2 ... suite suite_1 ok suite suite_2 ok
您只需一起运行所有测试即可:
$ multisuite ... suite suite_1 ok suite suite_2 ok
tipps
You do not need to spell the prefix ^{tt6}$ explicitly. Both the following commands are equal:
$ multisuite makesuite suite_bugfixes suite_unittests $ multisuite makesuite bugfixes unittestsWhen developing on new test cases the ^{tt7}$ command might come in handy, it takes the user to the folder of a test suite, initializes the virtualenv of that suite, and then starts a python shell. Therefore the environment in the python shell is the same as for the test cases of that suite. For more details:
$ multisuite shell -h