From 705c2ad92e63bf40489923e6b0764aec6bfdac8e Mon Sep 17 00:00:00 2001 From: Mikhail Burshteyn Date: Mon, 1 Apr 2024 18:16:25 +0300 Subject: [PATCH] Support Python 3.12 (#279) --- .github/workflows/ci.yml | 1 + README.md | 3 +- poetry.lock | 94 ++++++++----------- pyproject.toml | 4 +- setup.cfg | 8 +- tests/test_PT027_unittest_raises_assertion.py | 2 +- tests/test_config.py | 17 +++- 7 files changed, 64 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90a39b6..dd39704 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: - 3.9 - "3.10" - 3.11 + - 3.12 steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 1a81e71..cb37547 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,8 @@ MIT **Unreleased** -* require at least Python 3.8.0 +* require at least Python 3.8.1 +* support Python 3.12 **1.7.2 - 2023-02-15** diff --git a/poetry.lock b/poetry.lock index 114417a..a571072 100644 --- a/poetry.lock +++ b/poetry.lock @@ -259,19 +259,19 @@ test = ["pytest (>=6)"] [[package]] name = "flake8" -version = "4.0.1" +version = "7.0.0" description = "the modular source code checker: pep8 pyflakes and co" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8.1" files = [ - {file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"}, - {file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"}, + {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, + {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, ] [package.dependencies] -mccabe = ">=0.6.0,<0.7.0" -pycodestyle = ">=2.8.0,<2.9.0" -pyflakes = ">=2.4.0,<2.5.0" +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.11.0,<2.12.0" +pyflakes = ">=3.2.0,<3.3.0" [[package]] name = "flake8-annotations-complexity" @@ -320,20 +320,18 @@ pep8-naming = "*" [[package]] name = "flake8-bandit" -version = "3.0.0" +version = "4.1.1" description = "Automated security testing with bandit and flake8." optional = false python-versions = ">=3.6" files = [ - {file = "flake8_bandit-3.0.0-py2.py3-none-any.whl", hash = "sha256:61b617f4f7cdaa0e2b1e6bf7b68afb2b619a227bb3e3ae00dd36c213bd17900a"}, - {file = "flake8_bandit-3.0.0.tar.gz", hash = "sha256:54d19427e6a8d50322a7b02e1841c0a7c22d856975f3459803320e0e18e2d6a1"}, + {file = "flake8_bandit-4.1.1-py3-none-any.whl", hash = "sha256:4c8a53eb48f23d4ef1e59293657181a3c989d0077c9952717e98a0eace43e06d"}, + {file = "flake8_bandit-4.1.1.tar.gz", hash = "sha256:068e09287189cbfd7f986e92605adea2067630b75380c6b5733dab7d87f9a84e"}, ] [package.dependencies] bandit = ">=1.7.3" -flake8 = "*" -flake8-polyfill = "*" -pycodestyle = "*" +flake8 = ">=5.0.0" [[package]] name = "flake8-breakpoint" @@ -351,18 +349,18 @@ flake8-plugin-utils = ">=1.0,<2.0" [[package]] name = "flake8-bugbear" -version = "23.3.12" +version = "24.2.6" description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8.1" files = [ - {file = "flake8-bugbear-23.3.12.tar.gz", hash = "sha256:e3e7f74c8a49ad3794a7183353026dabd68c74030d5f46571f84c1fb0eb79363"}, - {file = "flake8_bugbear-23.3.12-py3-none-any.whl", hash = "sha256:beb5c7efcd7ccc2039ef66a77bb8db925e7be3531ff1cb4d0b7030d0e2113d72"}, + {file = "flake8-bugbear-24.2.6.tar.gz", hash = "sha256:f9cb5f2a9e792dd80ff68e89a14c12eed8620af8b41a49d823b7a33064ac9658"}, + {file = "flake8_bugbear-24.2.6-py3-none-any.whl", hash = "sha256:663ef5de80cd32aacd39d362212983bc4636435a6f83700b4ed35acbd0b7d1b8"}, ] [package.dependencies] attrs = ">=19.2.0" -flake8 = ">=3.0.0" +flake8 = ">=6.0.0" [package.extras] dev = ["coverage", "hypothesis", "hypothesmith (>=0.2)", "pre-commit", "pytest", "tox"] @@ -400,19 +398,19 @@ flake8 = ">=3.0,<3.2.0 || >3.2.0" [[package]] name = "flake8-eradicate" -version = "1.4.0" +version = "1.5.0" description = "Flake8 plugin to find commented out code" optional = false -python-versions = ">=3.7,<4.0" +python-versions = ">=3.8,<4.0" files = [ - {file = "flake8-eradicate-1.4.0.tar.gz", hash = "sha256:3088cfd6717d1c9c6c3ac45ef2e5f5b6c7267f7504d5a74b781500e95cb9c7e1"}, - {file = "flake8_eradicate-1.4.0-py3-none-any.whl", hash = "sha256:e3bbd0871be358e908053c1ab728903c114f062ba596b4d40c852fd18f473d56"}, + {file = "flake8_eradicate-1.5.0-py3-none-any.whl", hash = "sha256:18acc922ad7de623f5247c7d5595da068525ec5437dd53b22ec2259b96ce9d22"}, + {file = "flake8_eradicate-1.5.0.tar.gz", hash = "sha256:aee636cb9ecb5594a7cd92d67ad73eb69909e5cc7bd81710cf9d00970f3983a6"}, ] [package.dependencies] attrs = "*" eradicate = ">=2.0,<3.0" -flake8 = ">=3.5,<6" +flake8 = ">5" [[package]] name = "flake8-expression-complexity" @@ -486,20 +484,6 @@ files = [ {file = "flake8_plugin_utils-1.3.3-py3-none-any.whl", hash = "sha256:e4848c57d9d50f19100c2d75fa794b72df068666a9041b4b0409be923356a3ed"}, ] -[[package]] -name = "flake8-polyfill" -version = "1.0.2" -description = "Polyfill package for Flake8 plugins" -optional = false -python-versions = "*" -files = [ - {file = "flake8-polyfill-1.0.2.tar.gz", hash = "sha256:e44b087597f6da52ec6393a709e7108b2905317d0c0b744cdca6208e670d8eda"}, - {file = "flake8_polyfill-1.0.2-py2.py3-none-any.whl", hash = "sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9"}, -] - -[package.dependencies] -flake8 = "*" - [[package]] name = "flake8-print" version = "5.0.0" @@ -612,13 +596,13 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] [[package]] name = "mccabe" -version = "0.6.1" +version = "0.7.0" description = "McCabe checker, plugin for flake8" optional = false -python-versions = "*" +python-versions = ">=3.6" files = [ - {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, - {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, ] [[package]] @@ -725,17 +709,17 @@ files = [ [[package]] name = "pep8-naming" -version = "0.13.2" +version = "0.13.3" description = "Check PEP-8 naming conventions, plugin for flake8" optional = false python-versions = ">=3.7" files = [ - {file = "pep8-naming-0.13.2.tar.gz", hash = "sha256:93eef62f525fd12a6f8c98f4dcc17fa70baae2f37fa1f73bec00e3e44392fa48"}, - {file = "pep8_naming-0.13.2-py3-none-any.whl", hash = "sha256:59e29e55c478db69cffbe14ab24b5bd2cd615c0413edf790d47d3fb7ba9a4e23"}, + {file = "pep8-naming-0.13.3.tar.gz", hash = "sha256:1705f046dfcd851378aac3be1cd1551c7c1e5ff363bacad707d43007877fa971"}, + {file = "pep8_naming-0.13.3-py3-none-any.whl", hash = "sha256:1a86b8c71a03337c97181917e2b472f0f5e4ccb06844a0d6f0a33522549e7a80"}, ] [package.dependencies] -flake8 = ">=3.9.1" +flake8 = ">=5.0.0" [[package]] name = "platformdirs" @@ -769,24 +753,24 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pycodestyle" -version = "2.8.0" +version = "2.11.1" description = "Python style guide checker" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.8" files = [ - {file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"}, - {file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"}, + {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, + {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, ] [[package]] name = "pyflakes" -version = "2.4.0" +version = "3.2.0" description = "passive checker of Python programs" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.8" files = [ - {file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"}, - {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, ] [[package]] @@ -1072,5 +1056,5 @@ files = [ [metadata] lock-version = "2.0" -python-versions = "^3.8.0" -content-hash = "366537209be18ba428228881f8cd9c7d24c6a2a785ffac94be94e98158dc62ff" +python-versions = "^3.8.1" +content-hash = "f0a3fad7720f5f2d7d8761f3c0ef07e768bed3078d78e8b12de3b690255f5bc6" diff --git a/pyproject.toml b/pyproject.toml index 0c8ea0e..2edbf13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ PT = 'flake8_pytest_style.plugin:PytestStylePlugin' [tool.poetry.dependencies] -python = "^3.8.0" +python = "^3.8.1" flake8-plugin-utils = "^1.3.2" [tool.poetry.group.dev.dependencies] @@ -37,7 +37,7 @@ pylint = "^3.1.0" pytest = "^8.1.1" pytest-cov = "5.0.0" pytest-deadfixtures = "^2.1" -flake8 = "^4.0.1" +flake8 = "^7.0.0" pytest-mock = "^3.11.1" unify = "^0.5.0" tomlkit = "^0.12.1" diff --git a/setup.cfg b/setup.cfg index 01e595f..7afbe3a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,11 @@ [flake8] enable-extensions = G exclude = .git, .venv -ignore = - A003 ; 'id' is a python builtin, consider renaming the class attribute - W503 ; line break before binary operator +extend-ignore = + ; 'id' is a python builtin, consider renaming the class attribute + A003, + ; line break before binary operator + W503, max-complexity = 10 max-line-length = 88 per-file-ignores = diff --git a/tests/test_PT027_unittest_raises_assertion.py b/tests/test_PT027_unittest_raises_assertion.py index ebfa7b2..64b7189 100644 --- a/tests/test_PT027_unittest_raises_assertion.py +++ b/tests/test_PT027_unittest_raises_assertion.py @@ -27,5 +27,5 @@ def test_xxx(): UnittestAssertionVisitor, code, UnittestRaisesAssertion, - assertion="assertRaises", + assertion='assertRaises', ) diff --git a/tests/test_config.py b/tests/test_config.py index fc0db50..368ef84 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -16,14 +16,25 @@ @pytest.fixture() def option_manager() -> OptionManager: - manager = OptionManager(prog='flake8', version=flake8.__version__) + manager = OptionManager( + version=flake8.__version__, + plugin_versions='', # Not necessary in tests + parents=[], + formatter_names=[], + ) PytestStylePlugin.add_options(option_manager=manager) return manager def parse_options(manager: OptionManager, args: List[str]) -> Config: - namespace, remaining_args = manager.parse_args(args) - return PytestStylePlugin.parse_options_to_config(manager, namespace, remaining_args) + namespace = manager.parse_args(args) + return PytestStylePlugin.parse_options_to_config( + manager, + namespace, + # Not sure if this is semantically correct, but this is what flake8 passes + # to plugin's parse_options + namespace.filenames, + ) def test_parse_default(option_manager):