add test cases for timeout and retries #257
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push] | |
name: Run Test Cases | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
python_version: ['2.7', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9'] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
channels: conda-forge | |
python-version: ${{ matrix.python_version }} | |
activate-environment: qiniu-sdk | |
auto-activate-base: false | |
- name: Setup pip | |
shell: bash -l {0} | |
env: | |
PYTHON_VERSION: ${{ matrix.python_version }} | |
PIP_BOOTSTRAP_SCRIPT_PREFIX: https://bootstrap.pypa.io/pip | |
run: | | |
MAJOR=$(echo "$PYTHON_VERSION" | cut -d'.' -f1) | |
MINOR=$(echo "$PYTHON_VERSION" | cut -d'.' -f2) | |
# reinstall pip by some python(<3.7) not compatible | |
if ! [[ $MAJOR -ge 3 && $MINOR -ge 7 ]]; then | |
cd /tmp | |
wget -qLO get-pip.py "$PIP_BOOTSTRAP_SCRIPT_PREFIX/$MAJOR.$MINOR/get-pip.py" | |
python get-pip.py --user | |
fi | |
- name: Setup mock server | |
shell: bash -el {0} | |
run: | | |
conda create -y -n mock-server python=3.10 | |
conda init | |
conda activate mock-server | |
python3 --version | |
nohup python3 ./tests/mock-server/main.py --port 9000 > py-mock-server.log & | |
echo $! > mock-server.pid | |
conda deactivate | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -I -e ".[dev]" | |
- name: Run cases | |
shell: bash -el {0} | |
env: | |
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }} | |
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }} | |
QINIU_TEST_BUCKET: ${{ secrets.QINIU_TEST_BUCKET }} | |
QINIU_TEST_DOMAIN: ${{ secrets.QINIU_TEST_DOMAIN }} | |
QINIU_TEST_ENV: "travis" | |
MOCK_SERVER_ADDRESS: "http://127.0.0.1:9000" | |
PYTHONPATH: "$PYTHONPATH:." | |
run: | | |
python --version | |
flake8 --show-source --max-line-length=160 . | |
coverage run -m pytest ./test_qiniu.py ./tests/cases --ignore=./tests/mock_server | |
ocular --data-file .coverage | |
codecov | |
cat mock-server.pid | xargs kill | |
- name: Print mock server log | |
if: ${{ failure() }} | |
run: | | |
cat py-mock-server.log |