diff --git a/.github/workflows/oldest-postgres.yml b/.github/workflows/oldest-postgres.yml new file mode 100644 index 00000000..7f964ce2 --- /dev/null +++ b/.github/workflows/oldest-postgres.yml @@ -0,0 +1,79 @@ +name: Run pytest tests + +on: + workflow_call: + inputs: + python-versions: + description: 'Supported python versions' + default: '["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]' + required: false + type: string + postgresql: + description: 'PostgreSQL version' + default: 13 + type: number + os: + description: 'Operating system to run tests on' + default: 'ubuntu-latest' + required: false + type: string + secrets: + codecov_token: + description: 'Codecov token' + required: false + +jobs: + postgres: + runs-on: ${{ inputs.os }} + strategy: + fail-fast: false + matrix: + python-version: ${{ fromJSON(inputs.python-versions) }} + env: + OS: ${{ inputs.os }} + PYTHON: ${{ matrix.python-version }} + POSTGRES: ${{ inputs.postgresql }} + steps: + - uses: actions/checkout@v4 + - name: Set up Pipenv on python ${{ matrix.python-version }} + uses: fizyk/actions-reuse/.github/actions/pipenv-setup@v3.1.0 + with: + python-version: ${{ matrix.python-version }} + cache: false + - uses: ankane/setup-postgres@v1 + with: + postgres-version: ${{ inputs.postgresql }} + - name: Check installed locales + run: | + locale -a + - name: update locale for tests + if: ${{ inputs.os == 'ubuntu-latest' }} + run: | + sudo locale-gen de_DE.UTF-8 + - name: install libpq + if: ${{ contains(inputs.python-versions, 'pypy') }} + run: sudo apt install libpq5 + - name: Install oldest supported versions + uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0 + with: + command: pip install -r oldest-requirements.txt + - name: Run tests without xdist + uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0 + with: + command: py.test -svv -p no:xdist --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml + - name: Run xdist test + uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0 + with: + command: py.test -n auto --dist loadgroup --max-worker-restart 0 --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml:coverage-xdist.xml + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: postgresql-${{ matrix.python-version }}-${{ inputs.postgresql }} + path: /tmp/pytest-of-runner/** + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5.4.2 + with: + token: ${{ secrets.codecov_token }} + flags: unittests + env_vars: OS,PYTHON + fail_ci_if_error: false diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c6dee75d..06508796 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,9 @@ jobs: uses: ./.github/workflows/single-postgres.yml with: postgresql: 17 + postgresql_oldest: + needs: [postgresql_17] + uses: ./.github/workflows/oldest-postgres.yml postgresql_16: needs: [postgresql_17] uses: ./.github/workflows/single-postgres.yml diff --git a/newsfragments/1131.bugfix.rst b/newsfragments/1131.bugfix.rst new file mode 100644 index 00000000..432836ce --- /dev/null +++ b/newsfragments/1131.bugfix.rst @@ -0,0 +1,3 @@ +Update minimum required pytest version to 7.2 + +Additionally added test run of `pytest-postgresql` against oldest supported versions. diff --git a/oldest-requirements.txt b/oldest-requirements.txt new file mode 100644 index 00000000..f0011186 --- /dev/null +++ b/oldest-requirements.txt @@ -0,0 +1,4 @@ +pytest == 7.2 +port-for == 0.7.3 +mirakuru == 2.6.0 +psycopg == 3.0.0 diff --git a/pyproject.toml b/pyproject.toml index 73602b4b..c71d5fe1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ "Framework :: Pytest", ] dependencies = [ - "pytest >= 6.2", + "pytest >= 7.2", "port-for >= 0.7.3", "mirakuru >= 2.6.0", "packaging",