From b9b1a7ec8f4338902aaf7b930dafd12e43749713 Mon Sep 17 00:00:00 2001 From: Danny Sepler Date: Sat, 3 Jun 2023 21:46:14 -0400 Subject: [PATCH 1/3] bump python version --- .github/workflows/ci.yml | 2 +- pytestify/fixes/asserts.py | 7 +------ setup.cfg | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) 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/pytestify/fixes/asserts.py b/pytestify/fixes/asserts.py index 6559b64..7b3f2f6 100644 --- a/pytestify/fixes/asserts.py +++ b/pytestify/fixes/asserts.py @@ -169,12 +169,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 end_line = close_paren.line self.calls.append( Call( 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 = From 88ba31ebf209673d9ab693ad4008ddfdf7ff8569 Mon Sep 17 00:00:00 2001 From: Danny Sepler Date: Sat, 3 Jun 2023 21:56:09 -0400 Subject: [PATCH 2/3] Bump the required python version --- .pre-commit-config.yaml | 2 +- pytestify/fixes/asserts.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 7b3f2f6..91e7828 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 @@ -180,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 ), ) From 1786863cd186979216809e7b150b66721a7c0fa4 Mon Sep 17 00:00:00 2001 From: Danny Sepler Date: Sat, 3 Jun 2023 21:59:09 -0400 Subject: [PATCH 3/3] missed one --- pytestify/fixes/asserts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytestify/fixes/asserts.py b/pytestify/fixes/asserts.py index 91e7828..c103bb0 100644 --- a/pytestify/fixes/asserts.py +++ b/pytestify/fixes/asserts.py @@ -168,7 +168,7 @@ def visit_Call(self, call: ast.Call) -> None: # still rewrite it, but without specially handling it continue - kwargs[arg] = keyword.value + kwargs[arg] = keyword.value.value end_line = close_paren.line self.calls.append( Call(