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

3
请参考下面的存储库结构。我希望在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
2个回答

5

在CircleCI的帮助下,我学会了如何使用py.test:

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

我尝试了这个,但是当它尝试安装pytest时,我收到了“...ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. ...” 的警告。 - endolith

0
通常将build_dir设置为应用程序目录就足够了,我们会自己找到测试子目录。
请尝试使用此命令替换您在circle.yml中的当前命令,可以吗?
general:
  build_dir: app2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接