Skip to content

Commit

Permalink
Add support for Python 3.13
Browse files Browse the repository at this point in the history
* Upgrade pre-commit dependencies
* Upgrade Python requirements
  • Loading branch information
replaceafill authored Jan 13, 2025
1 parent 58e5fba commit 784cbab
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 32 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
test:
name: "Test Python ${{ matrix.python-version }}"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
strategy:
fail-fast: false
matrix:
Expand All @@ -18,6 +18,7 @@ jobs:
"3.10",
"3.11",
"3.12",
"3.13",
]
steps:
- name: "Check out repository"
Expand All @@ -33,10 +34,10 @@ jobs:
- name: "Install tox"
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install tox
- name: "Run tox"
run: |
tox -- --cov amclient --cov-report xml:coverage.xml
tox -e py -- --cov amclient --cov-report xml:coverage.xml
- name: "Upload coverage report"
if: github.repository == 'artefactual-labs/amclient'
uses: "codecov/codecov-action@v4"
Expand All @@ -48,14 +49,14 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
name: "Lint"
runs-on: "ubuntu-22.04"
runs-on: "ubuntu-24.04"
steps:
- name: "Check out repository"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.12"
python-version: "3.x"
cache: "pip"
cache-dependency-path: |
requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.5
rev: v0.9.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
10 changes: 2 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
authors = [
{name = "Artefactual Systems Inc.", email = "[email protected]"}
Expand Down Expand Up @@ -106,14 +107,7 @@ omit = [
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{39,310,311,312}, linting
[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
envlist = py, linting
[testenv]
skip_install = true
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pytest-cov==6.0.0
# via amclient (pyproject.toml)
requests==2.32.3
# via amclient (pyproject.toml)
ruff==0.8.5
ruff==0.9.1
# via amclient (pyproject.toml)
tomli==2.2.1
# via
Expand All @@ -64,5 +64,5 @@ zipp==3.21.0
# The following packages are considered to be unsafe in a requirements file:
pip==24.3.1
# via pip-tools
setuptools==75.6.0
setuptools==75.8.0
# via pip-tools
30 changes: 14 additions & 16 deletions tests/test_amclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ def test_get_transfer_status_invalid_uuid(call_url: mock.Mock):
message = response["message"]
message_type = response["type"]
assert message == (
"Cannot fetch unitTransfer with UUID 7bffc8f7-" "baad-f00d-8120-b1c51c2ab5db"
"Cannot fetch unitTransfer with UUID 7bffc8f7-baad-f00d-8120-b1c51c2ab5db"
)
assert message_type == "transfer"

Expand Down Expand Up @@ -2290,9 +2290,7 @@ def test_create_package_endpoint(call_url: mock.Mock):
except ValueError:
raise AssertionError()
# Provide a test for an absolute path, over relative above.
path = (
"/home/archivematica/archivematica-sampledata/SampleTransfers/" "DemoTransfer"
)
path = "/home/archivematica/archivematica-sampledata/SampleTransfers/DemoTransfer"
response = amclient.AMClient(
am_api_key=AM_API_KEY,
am_user_name=AM_USER_NAME,
Expand Down Expand Up @@ -2918,15 +2916,15 @@ def test_create_location(call_url: mock.Mock):

assert response.get("description") == test_desc, "Description returned is incorrect"
assert response.get("relative_path") == test_path_1, "Path returned is incorrect"
assert uri_pipeline_1 and uri_pipeline_2 in response.get(
"pipeline"
), "The specified pipelines are not in the API response"
assert uri_pipeline_1 and uri_pipeline_2 in response.get("pipeline"), (
"The specified pipelines are not in the API response"
)
assert response.get("resource_uri"), "Resource URI is not in response as expected"
assert response.get("uuid"), "UUID for the new location not returned"
assert response.get("default") is False, "Space default has returned incorrectly"
assert (
response.get("purpose") == purpose_transfer
), "Incorrect purpose assigned to newly created location"
assert response.get("purpose") == purpose_transfer, (
"Incorrect purpose assigned to newly created location"
)
assert response.get("space") == uri_space, "Incorrect URI for our space returned"

# Create an archival storage location and assign it to one pipeline.
Expand All @@ -2947,9 +2945,9 @@ def test_create_location(call_url: mock.Mock):
assert uri_pipeline_1 in response.get("pipeline")
assert len(response.get("pipeline")) == 1
assert response.get("default") is True
assert (
response.get("purpose") == purpose_aip_storage
), "Incorrect purpose assigned to newly created location"
assert response.get("purpose") == purpose_aip_storage, (
"Incorrect purpose assigned to newly created location"
)

# Create a DIP storage location and provide no description.
response = amclient.AMClient(
Expand All @@ -2965,9 +2963,9 @@ def test_create_location(call_url: mock.Mock):
).create_location()

assert response.get("description") == ""
assert (
response.get("purpose") == purpose_dip_storage
), "Incorrect purpose assigned to newly created location"
assert response.get("purpose") == purpose_dip_storage, (
"Incorrect purpose assigned to newly created location"
)

assert call_url.mock_calls == [
mock.call(
Expand Down

0 comments on commit 784cbab

Please sign in to comment.