Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,9 @@ jobs:

matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'

steps:
- name: Checkout the source code
Expand Down Expand Up @@ -109,12 +106,9 @@ jobs:

matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'

steps:
- name: Checkout the source code
Expand Down
8 changes: 8 additions & 0 deletions pg_backup_api/news.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# pg-backup-api News - History of user-visible changes

pg-backup-api release notes:
- version: "2.3.0"
date: "20260826"
changes:
Notable changes:
- |
Drop support for Python versions older than 3.12. The earliest Python
version supported is now 3.12.

- version: "2.2.0"
date: "20250912"
changes:
Expand Down
23 changes: 16 additions & 7 deletions pg_backup_api/pg_backup_api/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# along with Postgres Backup API. If not, see <http://www.gnu.org/licenses/>.

"""Unit tests for the CLI."""
import sys
import re
from textwrap import dedent
from unittest.mock import MagicMock, patch

Expand All @@ -26,6 +26,18 @@
from pg_backup_api.__main__ import main


def _normalize_usage(text):
"""Collapse argparse usage line continuations into a single line.

argparse changed its line-wrapping algorithm in Python 3.13, causing the
usage line to break at different points across versions. Normalizing both
the actual and expected output makes the comparison version-agnostic.
"""
head, sep, rest = text.partition("\n\n")
head = re.sub(r"\n\s+(?=\S)", " ", head)
return head + (sep + rest if sep else "")


_HELP_OUTPUT = {
"pg-backup-api --help": dedent(
"""\
Expand Down Expand Up @@ -142,13 +154,10 @@ def test_main_helper(mock_term_size, command, capsys):

assert str(exc.value) == "0"

expected = _HELP_OUTPUT[command]
version = sys.version_info

if version.major >= 3 and version.minor >= 10:
expected = expected.replace("optional arguments:", "options:")
expected = _HELP_OUTPUT[command].replace("optional arguments:", "options:")

assert capsys.readouterr().out == expected
actual = _normalize_usage(capsys.readouterr().out)
assert actual == _normalize_usage(expected)


@pytest.mark.parametrize("command", _COMMAND_FUNC.keys())
Expand Down
27 changes: 0 additions & 27 deletions pg_backup_api/pg_backup_api/tests/test_utility_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
# along with Postgres Backup API. If not, see <http://www.gnu.org/licenses/>.

"""Unit tests for the REST API endpoints."""
from distutils.version import StrictVersion
import json
import sys
from unittest.mock import Mock, MagicMock, patch

import flask
import pytest

from pg_backup_api.server_operation import (
Expand Down Expand Up @@ -346,18 +343,6 @@ def test_server_operation_post_not_json(self, client):

expected_status_code = 415
expected_data = b"Unsupported Media Type"
version = sys.version_info

# This is an issue which was detected while running tests through
# GitHub Actions when using Python 3.7 and Flask 2.2.5. We might want
# to remove this once we remove support for Python 3.7
if (
version.major <= 3
and version.minor <= 7
and StrictVersion(flask.__version__) <= StrictVersion("2.2.5")
):
expected_status_code = 400
expected_data = b"Bad Request"

assert response.status_code == expected_status_code
assert expected_data in response.data
Expand Down Expand Up @@ -833,18 +818,6 @@ def test_instance_operation_post_not_json(self, client):

expected_status_code = 415
expected_data = b"Unsupported Media Type"
version = sys.version_info

# This is an issue which was detected while running tests through
# GitHub Actions when using Python 3.7 and Flask 2.2.5. We might want
# to remove this once we remove support for Python 3.7
if (
version.major <= 3
and version.minor <= 7
and StrictVersion(flask.__version__) <= StrictVersion("2.2.5")
):
expected_status_code = 400
expected_data = b"Bad Request"

assert response.status_code == expected_status_code
assert expected_data in response.data
Expand Down
2 changes: 1 addition & 1 deletion pg_backup_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
author_email="barman@enterprisedb.com",
url="http://www.pgbarman.org/",
keywords=["Postgres Backup REST API"],
python_requires=">=3.6",
python_requires=">=3.12",
install_requires=REQUIRES,
Comment thread
joao00001 marked this conversation as resolved.
packages=find_packages(exclude=["tests"]),
include_package_data=True,
Expand Down
8 changes: 5 additions & 3 deletions pg_backup_api/tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[common]
python_matrix = {37,38,39,310,311}
python_matrix = {312,313,314}
platforms =
lin: linux
mac: darwin
Expand Down Expand Up @@ -33,7 +33,7 @@ commands = flake8 {posargs:pg_backup_api setup.py}
deps =
flake8

[testenv:py{37,38,39,310,311}-test-{lin,win,mac}]
[testenv:py{312,313,314}-test-{lin,win,mac}]
description = Run unit tests with pytest
labels =
test
Expand Down Expand Up @@ -72,7 +72,7 @@ deps =
-r requirements.txt
pipdeptree

[testenv:py{37,38,39,310,311}-type-{lin,mac,win}]
[testenv:py{312,313,314}-type-{lin,mac,win}]
description = Run static type checking with pyright
labels =
type
Expand All @@ -85,6 +85,8 @@ platform =

[flake8]
max-line-length = 79
per-file-ignores =
pg_backup_api/tests/*.py:E501

[coverage:run]
omit =
Expand Down
Loading