diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 12bfe71..e393640 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -15,8 +15,8 @@ jobs: lint: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6.2.0 with: python-version: "3.11" - uses: pre-commit/action@v3.0.1 @@ -30,6 +30,8 @@ jobs: fail-fast: false matrix: py: + - "3.14" + - "3.13" - "3.12" - "3.11" - "3.10" @@ -40,15 +42,15 @@ jobs: - "pypy-3.8" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: setup python for tox - uses: actions/setup-python@v5 + uses: actions/setup-python@v6.2.0 with: python-version: "3.12" - name: install tox run: python -m pip install tox - name: setup python for test ${{ matrix.py }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6.2.0 with: python-version: ${{ matrix.py }} - name: Pick environment to run @@ -64,26 +66,23 @@ jobs: run: tox -vv --notest - name: run test suite for ${{ matrix.py }} run: tox --skip-pkg-install - - name: Rename coverage report file - run: | - import os; import sys - os.rename(f".tox/.coverage.{os.environ['TOXENV']}", f".tox/.coverage.{os.environ['TOXENV']}-{sys.platform}") - shell: python - name: Upload coverage data - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v7 with: - name: coverage-data + name: coverage-data-${{ matrix.py }} path: ".tox/.coverage.*" + include-hidden-files: true + overwrite: true coverage: name: Combine coverage runs-on: ubuntu-latest needs: test steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6.2.0 with: python-version: "3.12" - name: Install tox @@ -95,14 +94,15 @@ jobs: - name: Build package run: pyproject-build --wheel . - name: Download coverage data - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v7 with: - name: coverage-data + pattern: coverage-data-* + merge-multiple: true path: .tox - name: Combine and report coverage run: tox -e coverage - name: Upload HTML report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v7 with: name: html-report path: .tox/htmlcov @@ -118,9 +118,9 @@ jobs: - docs - type steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: setup Python "3.12" - uses: actions/setup-python@v5 + uses: actions/setup-python@v6.2.0 with: python-version: "3.12" - name: install tox @@ -134,12 +134,12 @@ jobs: runs-on: ubuntu-22.04 steps: - name: setup python to build package - uses: actions/setup-python@v5 + uses: actions/setup-python@v6.2.0 with: python-version: "3.12" - name: install build run: python -m pip install build - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: build package run: python -m build --sdist --wheel . -o dist - name: publish to PyPi diff --git a/tests/test_auto_attribs__py3.py b/tests/test_auto_attribs__py3.py index 67b3ff8..8241f9d 100644 --- a/tests/test_auto_attribs__py3.py +++ b/tests/test_auto_attribs__py3.py @@ -28,9 +28,13 @@ None, 0xBAD, "Value of value 2989 is not of type {}".format( - "typing.Optional[str]" - if sys.version_info == (2, 7) or sys.version_info > (3, 9) - else "typing.Union[str, NoneType]" + "str | None" + if sys.version_info >= (3, 14) + else ( + "typing.Optional[str]" + if sys.version_info == (2, 7) or sys.version_info > (3, 9) + else "typing.Union[str, NoneType]" + ) ), ), ], @@ -75,9 +79,13 @@ def test_recursive(): Self(Self()) Self(Self(None)) type_repr = ( - "typing.Optional[test_auto_attribs__py3.Self]" - if sys.version_info == (2, 7) or sys.version_info > (3, 9) - else "typing.Union[test_auto_attribs__py3.Self, NoneType]" + "test_auto_attribs__py3.Self | None" + if sys.version_info >= (3, 14) + else ( + "typing.Optional[test_auto_attribs__py3.Self]" + if sys.version_info == (2, 7) or sys.version_info > (3, 9) + else "typing.Union[test_auto_attribs__py3.Self, NoneType]" + ) ) msg = f"Value of parent 17 is not of type {type_repr}" with pytest.raises(ValueError, match=re.escape(msg)): diff --git a/tests/test_union.py b/tests/test_union.py index e1b11a9..49d7c20 100644 --- a/tests/test_union.py +++ b/tests/test_union.py @@ -16,16 +16,26 @@ ( 2.0, Union[int, str], - "Value of foo 2.0 is not of type typing.Union[int, str]", + ( + "Value of foo 2.0 is not of type {}".format( + "int | str" + if sys.version_info >= (3, 14) + else "typing.Union[int, str]" + ) + ), ), ( [1, 2, "p"], List[Union[None, int]], ( "Value of foo p is not of type {} in [1, 2, 'p']".format( - "typing.Optional[int]" - if sys.version_info >= (3, 9) - else "typing.Union[NoneType, int]" + "None | int" + if sys.version_info >= (3, 14) + else ( + "typing.Optional[int]" + if sys.version_info >= (3, 9) + else "typing.Union[NoneType, int]" + ) ) ), ),