Skip to content

Commit 243dcb3

Browse files
committed
Test against oldest supported versions - closes #1131
1 parent 2b7191c commit 243dcb3

File tree

5 files changed

+90
-1
lines changed

5 files changed

+90
-1
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Run pytest tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-versions:
7+
description: 'Supported python versions'
8+
default: '["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]'
9+
required: false
10+
type: string
11+
postgresql:
12+
description: 'PostgreSQL version'
13+
default: 13
14+
type: number
15+
os:
16+
description: 'Operating system to run tests on'
17+
default: 'ubuntu-latest'
18+
required: false
19+
type: string
20+
secrets:
21+
codecov_token:
22+
description: 'Codecov token'
23+
required: false
24+
25+
jobs:
26+
postgres:
27+
runs-on: ${{ inputs.os }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
python-version: ${{ fromJSON(inputs.python-versions) }}
32+
env:
33+
OS: ${{ inputs.os }}
34+
PYTHON: ${{ matrix.python-version }}
35+
POSTGRES: ${{ inputs.postgresql }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Set up Pipenv on python ${{ matrix.python-version }}
39+
uses: fizyk/actions-reuse/.github/actions/pipenv-setup@v3.1.0
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
cache: false
43+
- uses: ankane/setup-postgres@v1
44+
with:
45+
postgres-version: ${{ inputs.postgresql }}
46+
- name: Check installed locales
47+
run: |
48+
locale -a
49+
- name: update locale for tests
50+
if: ${{ inputs.os == 'ubuntu-latest' }}
51+
run: |
52+
sudo locale-gen de_DE.UTF-8
53+
- name: install libpq
54+
if: ${{ contains(inputs.python-versions, 'pypy') }}
55+
run: sudo apt install libpq5
56+
- name: Install oldest supported versions
57+
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0
58+
with:
59+
command: pip install -r oldest-requirements.txt
60+
- name: Run tests without xdist
61+
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0
62+
with:
63+
command: py.test -svv -p no:xdist --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml
64+
- name: Run xdist test
65+
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0
66+
with:
67+
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
68+
- uses: actions/upload-artifact@v4
69+
if: failure()
70+
with:
71+
name: postgresql-${{ matrix.python-version }}-${{ inputs.postgresql }}
72+
path: /tmp/pytest-of-runner/**
73+
- name: Upload coverage to Codecov
74+
uses: codecov/codecov-action@v5.4.2
75+
with:
76+
token: ${{ secrets.codecov_token }}
77+
flags: unittests
78+
env_vars: OS,PYTHON
79+
fail_ci_if_error: false

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
uses: ./.github/workflows/single-postgres.yml
1212
with:
1313
postgresql: 17
14+
postgresql_oldest:
15+
needs: [postgresql_17]
16+
uses: ./.github/workflows/oldest-postgres.yml
1417
postgresql_16:
1518
needs: [postgresql_17]
1619
uses: ./.github/workflows/single-postgres.yml

newsfragments/1131.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Update minimum required pytest version to 7.2
2+
3+
Additionally added test run of `pytest-postgresql` against oldest supported versions.

oldest-requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pytest == 7.2
2+
port-for == 0.7.3
3+
mirakuru == 2.6.0
4+
psycopg == 3.0.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ classifiers = [
2828
"Framework :: Pytest",
2929
]
3030
dependencies = [
31-
"pytest >= 6.2",
31+
"pytest >= 7.2",
3232
"port-for >= 0.7.3",
3333
"mirakuru >= 2.6.0",
3434
"packaging",

0 commit comments

Comments
 (0)