请参阅下面的回购结构.我想在root/app2/tests /中运行测试.我正在使用py.test.
在CircleCi无法自动推断测试目录之后,我将circle.yml文件添加到根目录但仍未找到测试.任何帮助非常感谢.
circle.yml文件内容:
general:
build_dir: app2/tests
Run Code Online (Sandbox Code Playgroud)
存储库结构:
root
??? circle.yml
??? app1
? ??? xxx
? ??? yyy
?
??? app2
??? src
??? tests
|-- test_module_1.py
|-- test_module_2.py
Run Code Online (Sandbox Code Playgroud)
好的,在CircleCI的帮助下,我想出了如何在CircleCI中使用py.test:
在circle.yml文件中添加:
test:
override:
- py.test <optional path to subdir with tests>
dependencies:
pre:
- pip install pytest
Run Code Online (Sandbox Code Playgroud)
如果你的代码除了py.test之外还依赖于几个包,你可以创建一个requirements.txt文件:
pip freeze > requirements.txt
Run Code Online (Sandbox Code Playgroud)
将requirements.txt文件放在与circle.yml文件相同的目录中(如果已在circle.yml文件中指定,则放在build_dir中)并添加到circle.yml:
dependencies:
pre:
- pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)