Lock/unlock of db breaks if pytest is executed twice in the same process (fixes #1147) #489
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
name: main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
PYTEST_ADDOPTS: "--color=yes" | |
# Set permissions at the job level. | |
permissions: {} | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
continue-on-error: ${{ matrix.allow_failure }} | |
timeout-minutes: 15 | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Setup mysql | |
if: contains(matrix.name, 'mysql') | |
run: | | |
sudo systemctl start mysql.service | |
echo "TEST_DB_USER=root" >> $GITHUB_ENV | |
echo "TEST_DB_PASSWORD=root" >> $GITHUB_ENV | |
- name: Setup postgresql | |
if: contains(matrix.name, 'postgres') | |
run: | | |
sudo systemctl start postgresql.service | |
sudo -u postgres createuser --createdb $USER | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox==4.11.1 | |
- name: Run tox | |
run: tox -e ${{ matrix.name }} | |
- name: Report coverage | |
if: contains(matrix.name, 'coverage') | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
files: ./coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: linting,docs | |
python: '3.12' | |
allow_failure: false | |
- name: py312-dj51-postgres-xdist-coverage | |
python: '3.12' | |
allow_failure: false | |
- name: py312-dj42-postgres-xdist-coverage | |
python: '3.12' | |
allow_failure: false | |
- name: py311-dj50-postgres-xdist-coverage | |
python: '3.11' | |
allow_failure: false | |
- name: py311-dj42-postgres-xdist-coverage | |
python: '3.11' | |
allow_failure: false | |
- name: py310-dj51-postgres-xdist-coverage | |
python: '3.10' | |
allow_failure: false | |
- name: py310-dj42-postgres-xdist-coverage | |
python: '3.10' | |
allow_failure: false | |
- name: py311-dj51-mysql_innodb-coverage | |
python: '3.11' | |
allow_failure: false | |
- name: py310-dj42-mysql_innodb-coverage | |
python: '3.10' | |
allow_failure: false | |
- name: py39-dj42-mysql_innodb-xdist-coverage | |
python: '3.9' | |
allow_failure: false | |
- name: py312-dj51-sqlite-xdist-coverage | |
python: '3.12' | |
allow_failure: false | |
- name: py38-dj42-sqlite-xdist-coverage | |
python: '3.8' | |
allow_failure: false | |
- name: py311-djmain-sqlite-coverage | |
python: '3.11' | |
allow_failure: true | |
- name: py311-dj42-mysql_myisam-coverage | |
python: '3.11' | |
allow_failure: false | |
# Explicitly test min pytest. | |
- name: py38-dj42-sqlite-pytestmin-coverage | |
python: '3.8' | |
allow_failure: false | |
# pypy3: not included with coverage reports (much slower then). | |
- name: pypy3-dj42-postgres | |
python: 'pypy3.9' | |
allow_failure: false |