From a66b3056a69401cf8792664d57848a30e16e913c Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Wed, 14 Feb 2024 16:32:20 +0800 Subject: [PATCH 1/2] Update test_api to match pypy3.10 --- pyflakes/test/test_api.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py index ec1cbdbf..79c75526 100644 --- a/pyflakes/test/test_api.py +++ b/pyflakes/test/test_api.py @@ -405,10 +405,10 @@ def evaluate(source): self.fail() with self.makeTempFile(source) as sourcePath: - if PYPY: - message = 'end of file (EOF) while scanning triple-quoted string literal' - elif sys.version_info >= (3, 10): + if sys.version_info >= (3, 10): message = 'unterminated triple-quoted string literal (detected at line 8)' # noqa: E501 + elif PYPY: + message = 'end of file (EOF) while scanning triple-quoted string literal' else: message = 'invalid syntax' @@ -430,10 +430,10 @@ def test_eofSyntaxError(self): syntax error reflects the cause for the syntax error. """ with self.makeTempFile("def foo(") as sourcePath: - if PYPY: - msg = 'parenthesis is never closed' - elif sys.version_info >= (3, 10): + if sys.version_info >= (3, 10): msg = "'(' was never closed" + elif PYPY: + msg = 'parenthesis is never closed' else: msg = 'unexpected EOF while parsing' @@ -611,9 +611,14 @@ def test_misencodedFileUTF8(self): x = "%s" """ % SNOWMAN).encode('utf-8') with self.makeTempFile(source) as sourcePath: - self.assertHasErrors( - sourcePath, - [f"{sourcePath}:1:1: 'ascii' codec can't decode byte 0xe2 in position 21: ordinal not in range(128)\n"]) # noqa: E501 + if PYPY and sys.version_info >= (3, 10): + prefix = f"{sourcePath}:1:" + else: + prefix = f"{sourcePath}:1:1:" + error = f"{prefix} 'ascii' codec can't decode byte 0xe2 in position 21: ordinal not in range(128)\n" # noqa: E501 + if PYPY and sys.version_info >= (3, 10): + error += "# coding: ascii\n" + self.assertHasErrors(sourcePath, [error]) def test_misencodedFileUTF16(self): """ From 6a77e2266d63b97131e46f3c24af783d0be2ada4 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Wed, 14 Feb 2024 16:24:08 +0800 Subject: [PATCH 2/2] Update pythons in CI --- .github/workflows/test.yml | 10 +++++----- tox.ini | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eacd67c6..e72e4360 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,19 +12,19 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy-3.9"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev", "pypy-3.9", "pypy-3.10"] os: [ubuntu-latest] # Include minimum py3 + maximum py3 + pypy3 on Windows include: - { os: "windows-latest" , python-version: "3.8" } - - { os: "windows-latest" , python-version: "3.11" } - - { os: "windows-latest" , python-version: "pypy-3.9" } + - { os: "windows-latest" , python-version: "3.12" } + - { os: "windows-latest" , python-version: "pypy-3.10" } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/tox.ini b/tox.ini index 7a2a7712..7edaff4b 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ skip_missing_interpreters = True envlist = py,pypy3 [testenv] -deps = flake8==6.1.0 +deps = flake8==7.0.0 setenv = PYFLAKES_ERROR_UNKNOWN=1 commands = python --version --version