Bitbuket 管道 pytest 问题

Bitbuket pipeline pytest issue

提问人:Adam Massias 提问时间:10/28/2023 更新时间:10/28/2023 访问量:16

问:

我在 tests/test_main.py 下的目录中有一个 test 文件夹,在这个文件中,我在 if 语句中调用 pytest 功能,如下所示;


- if python3.9 -m pytest; then
     echo "Tests passed";
  else 
     echo "Tests failed";

我第一次提交此代码时,我收到了预期的所有测试通过 8/8。在接下来的运行中,我向test_main.py文件添加了一个函数,这是一个简单的测试,断言 2+2 = 5 将失败。当通过代码提交时,一切正常,但此更改未被选中 - 仍然收到 8/8 通过。然后我尝试更改之前失败但仍然未被选中的函数之一。

这是我添加的测试功能

# Test that should fail
def test_example():
    assert 2 + 2 == 5

我在想可能有一个 bitbucket 应用的缓存,我似乎无法理解?

这是我测试bitbucket-pipelines.yml文件的开始

image: python:3.9

pipelines:
  branches:
    dev:
      - step:
          name: Build and Deploy - Dev
          services:
            - docker
          script:
            - echo "Setting environment variables"

我尝试过的一切都在上面说过。任何帮助都会很棒!

yaml pytest cicd bitbucket-pipelines

评论


答: 暂无答案