我编写了一个用于处理文件权限的小实用程序包。结构遵循Python 包标准:
.
|-- __init__.py # All the code is here, for now
`-- tests
|-- __init__.py
|-- permission_mode.feature # Feature files for behave
|-- steps
| |-- __init__.py
| `-- steps.py # Step files for behave
`-- test_modtools.py # Nose tests
鼻子和行为都可以从命令行运行测试,没有问题:
鼻子:
$ nosetests
.
----------------------------------------------------------------------
Ran 1 test in 0.002s
OK
表现:
$ behave
Feature: Lots of cheese # permission_mode.feature:1
Scenario: blah # permission_mode.feature:2
Given a # steps/steps.py:1 0.000s
Then b # steps/steps.py:5 0.000s
1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
2 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m0.000s
我的setup.py
文件包含以下测试规范:
test_suite='nose.collector',
tests_require=['nose']
因此python setup.py test
以与 . 相同的输出运行鼻子测试nosetests
。
如何将行为配置为包的测试工具,以便python setup.py test
运行行为?