[英]gitlab-ci not running pytest after environment activated
I have a very basic python app that I'm testing with to get the CI working.我有一个非常基本的 python 应用程序,我正在测试它以使 CI 工作。 I have a gitlab-ci.yml file that contains the following which runs on a windows gitlab runner.
我有一个 gitlab-ci.yml 文件,其中包含在 Windows gitlab runner 上运行的以下内容。
test:
script:
- conda env create -f environment.yml
- activate scraper-worker
- python -m pytest
It creates the environment ok, but as soon as the the environment is activated it just prints out: Job succeeded, and it never runs pytest, it just finishes.它可以创建环境,但是一旦环境被激活,它就会打印出:作业成功,并且它从不运行 pytest,它只是完成了。
If I comment out the activate scraper-worker line then pytest will run, but it fails obviously because the environment isn't active.如果我注释掉 activate scraper-worker 行,则 pytest 将运行,但它显然会失败,因为环境未处于活动状态。 Any idea what I've got wrong here?
知道我在这里做错了什么吗?
Just as an FYI.仅供参考。 I have tried doing the environment setup and activation in a before_script, but again, same thing.
我曾尝试在 before_script 中进行环境设置和激活,但同样的事情。 Env gets built and activated but the test never runs.
环境被构建并激活,但测试从未运行。
事实证明,我必须将 Shell = "powershell" 添加到我的 gitlab runner 配置中才能使其工作。
I still have the same issue of the Python environment not being activated even after configuring the gitlab-runner shell attribute.即使在配置了 gitlab-runner shell 属性后,我仍然存在 Python 环境未激活的相同问题。
I did this instead:我这样做了:
default:
before_script:
- conda env list
- $env:PATH += ";C:\Tools\miniconda\envs\myenv"
the conda env list
is for debugging purposes only. conda env list
仅用于调试目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.