【发布时间】:2019-12-30 10:50:14
【问题描述】:
我正在尝试将单元测试添加到我在 CircleCi 上的项目中。在本地,当我从终端运行“python -m unittest discover”时,它能够找到并运行所有 16 个测试。但在 CircleCi 上,它说:
Ran 0 tests in 0.000s
知道会发生什么吗? 是否缺少某些配置或环境变量?
我的项目结构:
project
├── src
│ ├── main
│ ├── python
│ ├── testing
│ ├──Test1.py
| ├──Test2.py
config.yml
version: 2
docker:
- image: circleci/python:3.7.5
jobs:
build:
steps:
- checkout
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
- run:
name: Install Python deps in a venv
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements/dev.txt
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}
paths:
- "venv"
- run:
name: Running tests
command: |
cd ~/project/src/main/python/testing/
python3 -m unittest discover
【问题讨论】:
标签: python-3.x python-unittest circleci-2.0