Skip to content

Commit d604ea9

Browse files
authored
feat: Support Python 3.12 and Python 3.13 (#898)
1 parent 0b03bc5 commit d604ea9

File tree

8 files changed

+43
-39
lines changed

8 files changed

+43
-39
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,40 @@ on:
99

1010
jobs:
1111
build:
12-
runs-on: ubuntu-20.04
12+
name: Build and unit tests
13+
runs-on: ubuntu-22.04
1314
strategy:
1415
matrix:
1516
python-version:
16-
- '3.6'
17-
- '3.7'
18-
- '3.8'
19-
- '3.9'
20-
- '3.10'
21-
- '3.11'
22-
name: Build with Python ${{ matrix.python-version }}
17+
- '3.6'
18+
- '3.7'
19+
- '3.8'
20+
- '3.9'
21+
- '3.10'
22+
- '3.11'
23+
- '3.12'
24+
- '3.13'
25+
container:
26+
image: python:${{ matrix.python-version }}
2327
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v2
26-
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v2
28-
with:
29-
python-version: ${{ matrix.python-version }}
30-
- name: Install dependencies
28+
- name: Checkout code
29+
uses: actions/checkout@v3
30+
31+
- name: Upgrade pip and install dependencies
3132
run: |
3233
python -m pip install --upgrade pip
3334
python -m pip install -e .[gh]
34-
- name: Test with tox
35-
run: tox
35+
36+
- name: Run tests with tox
37+
run: tox -e py$(echo "${{ matrix.python-version }}" | tr -d '.')
3638
coverage:
3739
name: Coverage report
38-
runs-on: ubuntu-20.04
40+
runs-on: ubuntu-latest
41+
container:
42+
image: python:3.13
3943
steps:
4044
- name: Checkout
41-
uses: actions/checkout@v2
42-
- name: Set up Python 3.11
43-
uses: actions/setup-python@v2
44-
with:
45-
python-version: '3.11'
45+
uses: actions/checkout@v3
4646
- name: Install dependencies
4747
run: |
4848
python -m pip install --upgrade pip

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ on:
1010
jobs:
1111
tests:
1212
name: Integration tests
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1414
strategy:
1515
max-parallel: 1
1616
matrix:
1717
python-version:
1818
- '3.6'
19-
- '3.11'
19+
- '3.12'
20+
- '3.13'
21+
container:
22+
image: python:${{ matrix.python-version }}
2023
steps:
2124
- name: Checkout
22-
uses: actions/checkout@v2
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
25-
with:
26-
python-version: ${{ matrix.python-version }}
25+
uses: actions/checkout@v3
2726
- name: Install dependencies
2827
run: |
2928
python -m pip install --upgrade pip

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ tox
457457

458458
The tox tests include code style checks via pep8 and pylint.
459459

460-
The tox tests are configured to run on Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11.
460+
The tox tests are configured to run on Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13.
461461

462462
# Questions, Bugs, and Feature Requests?
463463

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'Programming Language :: Python :: 3.10',
2020
'Programming Language :: Python :: 3.11',
2121
'Programming Language :: Python :: 3.12',
22+
'Programming Language :: Python :: 3.13',
2223
'Programming Language :: Python :: Implementation :: CPython',
2324
'Operating System :: OS Independent',
2425
'Operating System :: POSIX',
@@ -62,7 +63,7 @@ def main():
6263
redis_requires = ['redis>=2.10.3']
6364
jwt_requires = ['pyjwt>=1.7.0', 'cryptography>=3']
6465
coveralls_requires = ['coveralls']
65-
dev_requires = ['tox<=3.28.0']
66+
dev_requires = ['tox<=3.28.0', 'setuptools']
6667
gh_requires = ['tox-gh-actions']
6768
test_requires = [
6869
'bottle',

test/unit/object/test_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def test_update_contents_with_stream_does_preflight_check_if_specified(
477477
test_file.update_contents_with_stream(**kwargs)
478478

479479
if preflight_check:
480-
assert test_file.preflight_check.called_once_with(size=file_size)
480+
test_file.preflight_check.assert_called_once_with(size=file_size)
481481
if preflight_fails:
482482
assert not mock_box_session.post.called
483483
else:
@@ -508,7 +508,7 @@ def test_update_contents_does_preflight_check_if_specified(
508508
test_file.update_contents(**kwargs)
509509

510510
if preflight_check:
511-
assert test_file.preflight_check.called_once_with(size=file_size)
511+
test_file.preflight_check.assert_called_once_with(size=file_size)
512512
if preflight_fails:
513513
assert not mock_box_session.post.called
514514
else:

test/unit/object/test_folder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def test_upload_stream_does_preflight_check_if_specified(
403403
test_folder.upload_stream(**kwargs)
404404

405405
if preflight_check:
406-
assert test_folder.preflight_check.called_once_with(size=file_size, name='foo.txt')
406+
test_folder.preflight_check.assert_called_once_with(size=file_size, name='foo.txt')
407407
_assert_post_called_correctly(mock_box_session, preflight_fails)
408408
else:
409409
assert not test_folder.preflight_check.called
@@ -439,7 +439,7 @@ def test_upload_does_preflight_check_if_specified(
439439
test_folder.upload(**kwargs)
440440

441441
if preflight_check:
442-
assert test_folder.preflight_check.called_once_with(size=file_size, name='foo.txt')
442+
test_folder.preflight_check.assert_called_once_with(size=file_size, name='foo.txt')
443443
_assert_post_called_correctly(mock_box_session, preflight_fails)
444444
else:
445445
assert not test_folder.preflight_check.called

test/unit/session/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ def test_box_session_seeks_file_after_retry(box_session, mock_network_layer, ser
217217
mock_file_2.tell.assert_called_with()
218218
mock_file_1.seek.assert_called_with(0)
219219
assert mock_file_1.seek.call_count == 2
220-
assert mock_file_1.seek.has_calls(call(0) * 2)
220+
mock_file_1.seek.assert_has_calls([call(0), call(0)])
221221
mock_file_2.seek.assert_called_with(3)
222222
assert mock_file_2.seek.call_count == 2
223-
assert mock_file_2.seek.has_calls(call(3) * 2)
223+
mock_file_2.seek.assert_has_calls([call(3), call(3)])
224224

225225

226226
def test_box_session_raises_for_non_json_response(box_session, mock_network_layer, non_json_response, generic_successful_response, test_url):

tox.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ envlist =
1313
py39,
1414
py310,
1515
py311,
16+
py312,
17+
py313,
1618
coverage,
1719
integration-tests
1820

@@ -24,6 +26,8 @@ python =
2426
3.9: py39
2527
3.10: py310
2628
3.11: py311
29+
3.12: py312
30+
3.13: py313
2731

2832
[testenv]
2933
commands =
@@ -47,7 +51,7 @@ deps =
4751
-rrequirements-test.txt
4852

4953
[testenv:coverage]
50-
basepython = python3.11
54+
basepython = python3.13
5155
commands =
5256
py.test --cov boxsdk --cov-report term-missing test/unit test/integration
5357
deps =

0 commit comments

Comments
 (0)