diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 868942b..8c60ae1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11"] os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ef7504..914b88c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: rev: v3.4.0 hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py38-plus] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.3.0 hooks: diff --git a/pytestify/fixes/asserts.py b/pytestify/fixes/asserts.py index 6559b64..c103bb0 100644 --- a/pytestify/fixes/asserts.py +++ b/pytestify/fixes/asserts.py @@ -2,7 +2,6 @@ import ast import re -import sys from dataclasses import dataclass, field from tokenize import TokenError from typing import NamedTuple @@ -169,12 +168,7 @@ def visit_Call(self, call: ast.Call) -> None: # still rewrite it, but without specially handling it continue - const = keyword.value - if sys.version_info >= (3, 8): - kwargs[arg] = const.value # type: ignore - else: - # Prior to Python 3.8, const is actually a ast.Num object - kwargs[arg] = const.n # type: ignore + kwargs[arg] = keyword.value.value end_line = close_paren.line self.calls.append( Call( @@ -185,7 +179,9 @@ def visit_Call(self, call: ast.Call) -> None: comments=comments, commas=commas, keywords=call.keywords, - **kwargs + # The below line triggers a mypy issue, + # see https://github.com/python/mypy/issues/5382. + **kwargs # type: ignore ), ) diff --git a/setup.cfg b/setup.cfg index 27cf795..3cf8869 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,7 @@ project_urls = packages = find: install_requires = tokenize-rt>=4.0.0 -python_requires = >=3.7 +python_requires = >=3.8 [options.packages.find] exclude =