Skip to content

Commit 6048175

Browse files
authored
fix: python3.12 testing and linting (#48)
1 parent 26fc488 commit 6048175

8 files changed

Lines changed: 33 additions & 16 deletions

File tree

.github/workflows/ci_static-analysis.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,22 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
category:
18+
- mypy-py3
19+
- bandit
20+
- doc8
1821
- readme
22+
- docs
23+
- flake8
24+
- pylint
25+
- flake8-tests
26+
- pylint-tests
27+
- black-check
1928
steps:
2029
- uses: actions/checkout@v2
2130
- uses: actions/setup-python@v2
2231
with:
23-
python-version: 3.x
32+
python-version: 3.11
33+
# Python 3.12 has pip issues, use 3.11
2434
- run: |
2535
python -m pip install --upgrade pip
2636
pip install --upgrade -r ci-requirements.txt

.github/workflows/ci_tests.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,27 @@ jobs:
2424
architecture: x86
2525
- os: macos-latest
2626
architecture: x64
27-
python:
28-
- 3.8
29-
- 3.9
30-
- "3.10"
31-
- "3.11"
27+
major:
28+
- 3
29+
minor:
30+
- 8
31+
- 9
32+
- 10
33+
- 11
34+
- 12
3235
category:
3336
# Runs the base test environment
3437
- py
3538
steps:
3639
- uses: actions/checkout@v2
3740
- uses: actions/setup-python@v2
3841
with:
39-
python-version: ${{ matrix.python }}
42+
python-version: '${{ matrix.major }}.${{ matrix.minor }}'
4043
architecture: ${{ matrix.platform.architecture }}
4144
- run: |
4245
python -m pip install --upgrade pip
4346
pip install --upgrade -r ci-requirements.txt
4447
- name: run test
4548
env:
46-
TOXENV: ${{ matrix.category }}
49+
TOXENV: '${{ matrix.category }}${{ matrix.major }}${{ matrix.minor }}'
4750
run: tox -- -vv

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ Getting Started
5353

5454
:class:`base64io.Base64IO` has no dependencies other than the standard library and and should
5555
work with any version of Python greater than 2.6.
56-
We test it on CPython 3.8, 3.9, 3.10, & 3.11.
57-
56+
We test it on CPython 3.8, 3.9, 3.10, 3.11, & 3.12.
57+
5858
Installation
5959
============
6060

ci-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
setuptools
12
tox==3.24.5

src/base64io/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ def _passthrough_interactive_check(self, method_name, mode):
159159
):
160160
return True
161161
return False
162-
else:
163-
return method()
162+
return method()
164163

165164
def writable(self):
166165
# type: () -> bool

test/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
setuptools
12
hypothesis>=3.56.0
23
mock
34
pytest>=3.3.1

test/unit/test_base64_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_base64io_always_false_methods(method_name):
5959
assert not getattr(test, method_name)()
6060

6161

62-
@pytest.mark.parametrize("method_name, args", (("fileno", ()), ("seek", (None,)), ("tell", ()), ("truncate", ())))
62+
@pytest.mark.parametrize("method_name, args", (("fileno", ()), ("seek", (4,)), ("tell", ()), ("truncate", ())))
6363
def test_unsupported_methods(method_name, args):
6464
test = Base64IO(io.BytesIO())
6565

tox.ini

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{38,39,310,311},
3+
py{38,39,310,311,312},
44
bandit, doc8, readme,
55
mypy-py3,
66
flake8, pylint,
@@ -13,7 +13,8 @@ envlist =
1313
# linters-tests :: Runs all linters over all tests.
1414

1515
[testenv:default-python]
16-
basepython = python3
16+
# 3.12 has pip issues, default to 3.11
17+
basepython = python3.11
1718

1819
[testenv:base-command]
1920
commands = pytest --basetemp={envtmpdir} -l --cov base64io {posargs}
@@ -26,7 +27,9 @@ passenv =
2627
# Pass through twine password -- remove this once secrets-helper is fixed
2728
# https://github.com/awslabs/secrets-helper/issues/15
2829
TWINE_PASSWORD
29-
deps = -rtest/requirements.txt
30+
deps =
31+
-rtest/requirements.txt
32+
py312: pip>=23.3.1
3033
commands = pytest --basetemp={envtmpdir} -l --cov base64io {posargs}
3134

3235
# mypy

0 commit comments

Comments
 (0)