From 063c9b3ca03d02d3fc7387a3bbb45f44b2c008a6 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:43:39 -0700 Subject: [PATCH 1/8] fix: python3.12 testing and linting --- .github/workflows/ci_static-analysis.yaml | 9 +++++++++ .github/workflows/ci_tests.yaml | 2 ++ README.rst | 2 +- src/base64io/__init__.py | 3 +-- test/unit/test_base64_stream.py | 2 +- tox.ini | 9 ++++++--- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_static-analysis.yaml b/.github/workflows/ci_static-analysis.yaml index edb7f8a..46f1ea9 100644 --- a/.github/workflows/ci_static-analysis.yaml +++ b/.github/workflows/ci_static-analysis.yaml @@ -15,7 +15,16 @@ jobs: fail-fast: false matrix: category: + - mypy-py3 + - bandit + - doc8 - readme + - docs + - flake8 + - pylint + - flake8-tests + - pylint-tests + - black-check steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index d27209e..f910904 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -29,6 +29,8 @@ jobs: - 3.9 - "3.10" - "3.11" + - "3.12" + - 3.x category: # Runs the base test environment - py diff --git a/README.rst b/README.rst index 422764b..67992cd 100644 --- a/README.rst +++ b/README.rst @@ -54,7 +54,7 @@ Getting Started :class:`base64io.Base64IO` has no dependencies other than the standard library and and should work with any version of Python greater than 2.6. We test it on CPython 3.8, 3.9, 3.10, & 3.11. - + Installation ============ diff --git a/src/base64io/__init__.py b/src/base64io/__init__.py index d5f4a99..c844958 100644 --- a/src/base64io/__init__.py +++ b/src/base64io/__init__.py @@ -159,8 +159,7 @@ def _passthrough_interactive_check(self, method_name, mode): ): return True return False - else: - return method() + return method() def writable(self): # type: () -> bool diff --git a/test/unit/test_base64_stream.py b/test/unit/test_base64_stream.py index c8349be..47465fc 100644 --- a/test/unit/test_base64_stream.py +++ b/test/unit/test_base64_stream.py @@ -59,7 +59,7 @@ def test_base64io_always_false_methods(method_name): assert not getattr(test, method_name)() -@pytest.mark.parametrize("method_name, args", (("fileno", ()), ("seek", (None,)), ("tell", ()), ("truncate", ()))) +@pytest.mark.parametrize("method_name, args", (("fileno", ()), ("seek", (4,)), ("tell", ()), ("truncate", ()))) def test_unsupported_methods(method_name, args): test = Base64IO(io.BytesIO()) diff --git a/tox.ini b/tox.ini index 8a935b9..53d407f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{38,39,310,311}, + py{38,39,310,311,312}, bandit, doc8, readme, mypy-py3, flake8, pylint, @@ -13,7 +13,8 @@ envlist = # linters-tests :: Runs all linters over all tests. [testenv:default-python] -basepython = python3 +# 3.12 has pip issues, default to 3.11 +basepython = python3.11 [testenv:base-command] commands = pytest --basetemp={envtmpdir} -l --cov base64io {posargs} @@ -26,7 +27,9 @@ passenv = # Pass through twine password -- remove this once secrets-helper is fixed # https://github.com/awslabs/secrets-helper/issues/15 TWINE_PASSWORD -deps = -rtest/requirements.txt +deps = + -rtest/requirements.txt + py312: pip>=23.3.1 commands = pytest --basetemp={envtmpdir} -l --cov base64io {posargs} # mypy From 4f17e8ccdd8c86b10d773417b346338f35bd394c Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:46:25 -0700 Subject: [PATCH 2/8] tests: Run Static Analysis with 3.11 --- .github/workflows/ci_static-analysis.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_static-analysis.yaml b/.github/workflows/ci_static-analysis.yaml index 46f1ea9..f9f93bc 100644 --- a/.github/workflows/ci_static-analysis.yaml +++ b/.github/workflows/ci_static-analysis.yaml @@ -1,4 +1,4 @@ -# This workflow runs static analysis checks on pull requests. +# This workflow runs static analysis checks on pull requests.l name: static analysis on: @@ -29,7 +29,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: 3.x + python-version: 3.11 + # Python 3.12 has pip issues, use 3.11 - run: | python -m pip install --upgrade pip pip install --upgrade -r ci-requirements.txt From 0a0de9f0394e77b50fd98b064a9f75c2f9f1c6a6 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:48:22 -0700 Subject: [PATCH 3/8] test: GitHub python3.x will not trigger tox pip conditional --- .github/workflows/ci_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index f910904..aa6eb86 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -30,7 +30,6 @@ jobs: - "3.10" - "3.11" - "3.12" - - 3.x category: # Runs the base test environment - py From a0798660610ed041240c565bf7a74775a45327b9 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:54:29 -0700 Subject: [PATCH 4/8] test: tox py env will not trigger tox pip conditional --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index aa6eb86..c4acc53 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -44,5 +44,5 @@ jobs: pip install --upgrade -r ci-requirements.txt - name: run test env: - TOXENV: ${{ matrix.category }} + TOXENV: '${{ matrix.category }}${{ matrix.python }}' run: tox -- -vv From 7af84f65c41657fca218fa86f3405e3c8a6fd8a1 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:59:42 -0700 Subject: [PATCH 5/8] test: refactor python defination to meet GH and tox --- .github/workflows/ci_tests.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index c4acc53..98d4b1f 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -24,12 +24,13 @@ jobs: architecture: x86 - os: macos-latest architecture: x64 - python: - - 3.8 - - 3.9 - - "3.10" - - "3.11" - - "3.12" + major: 3 + minor: + - 8 + - 9 + - 10 + - 11 + - 12 category: # Runs the base test environment - py @@ -37,12 +38,12 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python }} + python-version: '${{ matrix.major }}.${{ matrix.minor }}' architecture: ${{ matrix.platform.architecture }} - run: | python -m pip install --upgrade pip pip install --upgrade -r ci-requirements.txt - name: run test env: - TOXENV: '${{ matrix.category }}${{ matrix.python }}' + TOXENV: '${{ matrix.category }}${{ matrix.major }}${{ matrix.minor }}' run: tox -- -vv From 681c166cb9f1164fdced710c9cca1c9c85668d57 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:01:46 -0700 Subject: [PATCH 6/8] test: typo in GHW --- .github/workflows/ci_tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 98d4b1f..8b2684c 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -24,7 +24,8 @@ jobs: architecture: x86 - os: macos-latest architecture: x64 - major: 3 + major: + - 3 minor: - 8 - 9 From 48a2ba295d8541905701ff6b93ea24abc6a5f1d3 Mon Sep 17 00:00:00 2001 From: texastony <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:48:52 -0700 Subject: [PATCH 7/8] fix: install setuptools --- ci-requirements.txt | 1 + test/requirements.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/ci-requirements.txt b/ci-requirements.txt index 9a41a70..b673eb3 100644 --- a/ci-requirements.txt +++ b/ci-requirements.txt @@ -1 +1,2 @@ +setuptools tox==3.24.5 diff --git a/test/requirements.txt b/test/requirements.txt index a1e3afc..4425530 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1,3 +1,4 @@ +setuptools hypothesis>=3.56.0 mock pytest>=3.3.1 From aace83b0c2e71a1f7a82145ad8ab6722061032cc Mon Sep 17 00:00:00 2001 From: Tony Knapp <5892063+texastony@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:08:32 -0700 Subject: [PATCH 8/8] chore: Apply suggestions from code review --- .github/workflows/ci_static-analysis.yaml | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_static-analysis.yaml b/.github/workflows/ci_static-analysis.yaml index f9f93bc..ac20fba 100644 --- a/.github/workflows/ci_static-analysis.yaml +++ b/.github/workflows/ci_static-analysis.yaml @@ -1,4 +1,4 @@ -# This workflow runs static analysis checks on pull requests.l +# This workflow runs static analysis checks on pull requests. name: static analysis on: diff --git a/README.rst b/README.rst index 67992cd..190c3aa 100644 --- a/README.rst +++ b/README.rst @@ -53,7 +53,7 @@ Getting Started :class:`base64io.Base64IO` has no dependencies other than the standard library and and should work with any version of Python greater than 2.6. -We test it on CPython 3.8, 3.9, 3.10, & 3.11. +We test it on CPython 3.8, 3.9, 3.10, 3.11, & 3.12. Installation ============