gitlab-ci.yml:“脚本:-pytest”命令无法识别

use*_*648 5 python pytest gitlab gitlab-ci gitlab-ci-runner

我在 Windows 上实现在 .gitlab-ci.yml 中运行 pytest 的示例程序时遇到问题:

使用 Shell 执行器...

请找到下面的.gitlab-ci.yml:

# .gitlab-ci.yml

test_sample:
  stage: test
  tags: 
    - test_sam
  script:
    - echo "Testing"
    - pytest -s Target\tests 
  when: manual
Run Code Online (Sandbox Code Playgroud)

CI/CD端子输出:

pytest is not recognized as the name of a cmdlet, function, script file, or operable program.
Run Code Online (Sandbox Code Playgroud)

运行测试的Windows操作系统上已经安装了Python和pytest,但测试仍然失败。我已经尝试了下面线程中建议的解决方案,但它不起作用: gitlab-ci.yml: 'script: -pytest 找不到任何要检查的测试'

您能否建议如何在 Windows 上通过此测试?

use*_*648 -1

以下命令可以正常运行,没有任何问题:

py -m pytest -s Target\tests
Run Code Online (Sandbox Code Playgroud)