运行 在 conda 环境中的 circleci 测试
Running tests at circleci in conda environment
我使用 conda,并试图找出如何在 circleci 获取东西 运行。我在名为 calculator
的环境中有一个非常简单的项目,它具有两个功能(一个 addition
、一个 subtraction
和一个测试)。我正在使用 pylint8
检查格式,pytest
/pytest-cov
用于 testing/coverage.
我的配置文件如下,在我到达test-运行阶段之前似乎一直有效:
# Python CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
- image: continuumio/miniconda3
working_directory: ~/repo
steps:
# Step 1: obtain repo from GitHub
- checkout
# Step 2: create virtual env and install dependencies
- run:
name: install dependencies
command: |
conda env create -f environment.yml
# Step 3: run linter and tests
- run:
name: run tests
command: |
conda init bash
conda activate calculator
flake8 --statistics
pytest -v --cov
第 1 步和第 2 步工作正常,但第 3 步失败并显示以下消息:
#!/bin/bash -eo pipefail
conda init bash
conda activate calculator
flake8 --statistics
pytest -v --cov
no change /opt/conda/condabin/conda
no change /opt/conda/bin/conda
no change /opt/conda/bin/conda-env
no change /opt/conda/bin/activate
no change /opt/conda/bin/deactivate
no change /opt/conda/etc/profile.d/conda.sh
no change /opt/conda/etc/fish/conf.d/conda.fish
no change /opt/conda/shell/condabin/Conda.psm1
no change /opt/conda/shell/condabin/conda-hook.ps1
no change /opt/conda/lib/python3.7/site-packages/xontrib/conda.xsh
no change /opt/conda/etc/profile.d/conda.csh
modified /root/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
我在Ubuntu18,我之前不是运行conda init bash
,但是根据报错,我把它放在那里了,但是还是提示我初始化我的 shell 尽管我已经这样做了。
conda init bash
更改了您的 .bashrc
,然后必须重新加载。
你可以按这个顺序试试
conda init bash
source ~/.bashrc
conda activate calculator
或者干脆尝试 source activate calculator
的老式方式(根本没有 运行 conda init bash
)。
我使用 conda,并试图找出如何在 circleci 获取东西 运行。我在名为 calculator
的环境中有一个非常简单的项目,它具有两个功能(一个 addition
、一个 subtraction
和一个测试)。我正在使用 pylint8
检查格式,pytest
/pytest-cov
用于 testing/coverage.
我的配置文件如下,在我到达test-运行阶段之前似乎一直有效:
# Python CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
- image: continuumio/miniconda3
working_directory: ~/repo
steps:
# Step 1: obtain repo from GitHub
- checkout
# Step 2: create virtual env and install dependencies
- run:
name: install dependencies
command: |
conda env create -f environment.yml
# Step 3: run linter and tests
- run:
name: run tests
command: |
conda init bash
conda activate calculator
flake8 --statistics
pytest -v --cov
第 1 步和第 2 步工作正常,但第 3 步失败并显示以下消息:
#!/bin/bash -eo pipefail
conda init bash
conda activate calculator
flake8 --statistics
pytest -v --cov
no change /opt/conda/condabin/conda
no change /opt/conda/bin/conda
no change /opt/conda/bin/conda-env
no change /opt/conda/bin/activate
no change /opt/conda/bin/deactivate
no change /opt/conda/etc/profile.d/conda.sh
no change /opt/conda/etc/fish/conf.d/conda.fish
no change /opt/conda/shell/condabin/Conda.psm1
no change /opt/conda/shell/condabin/conda-hook.ps1
no change /opt/conda/lib/python3.7/site-packages/xontrib/conda.xsh
no change /opt/conda/etc/profile.d/conda.csh
modified /root/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
我在Ubuntu18,我之前不是运行conda init bash
,但是根据报错,我把它放在那里了,但是还是提示我初始化我的 shell 尽管我已经这样做了。
conda init bash
更改了您的 .bashrc
,然后必须重新加载。
你可以按这个顺序试试
conda init bash
source ~/.bashrc
conda activate calculator
或者干脆尝试 source activate calculator
的老式方式(根本没有 运行 conda init bash
)。