gpt4 book ai didi

testing - 为什么 CircleCi 找不到我的测试?

转载 作者:行者123 更新时间:2023-11-28 19:56:40 26 4
gpt4 key购买 nike

请参阅下面的 repo 结构。我想在 root/app2/tests/中运行测试。我正在使用 py.test。

在 CircleCi 无法自动推断测试目录后,我在根目录中添加了一个 circle.yml 文件,但仍然找不到测试。非常感谢任何帮助。

circle.yml文件内容:

general:
build_dir: app2/tests

存储库结构:

root
├── circle.yml
├── app1
│ ├── xxx
│ ├── yyy

└── app2
├── src
├── tests
|-- test_module_1.py
|-- test_module_2.py

最佳答案

好的,在 CircleCI 的帮助下,我想出了如何将 py.test 与 CircleCI 一起使用:

circle.yml文件中添加:

test:
override:
- py.test <optional path to subdir with tests>

dependencies:
pre:
- pip install pytest

如果您的代码除了 py.test 之外还依赖于多个包,您可以创建一个 requirements.txt 文件:

pip freeze > requirements.txt

将 requirements.txt 文件放在与 circle.yml 文件相同的目录中(如果您在 circle.yml 文件中指定了它,则放在 build_dir 中)并添加到 circle.yml:

dependencies:
pre:
- pip install -r requirements.txt

关于testing - 为什么 CircleCi 找不到我的测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31116665/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com