From b87ae3f69fe0c71b06c5ccf8e1539e54dc049a91 Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Wed, 25 Oct 2023 12:19:59 +0500 Subject: [PATCH 1/4] feat: pylint 3 & pythonn 3.12 --- .github/workflows/checks.yaml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/run-tests.yaml | 23 ++++++++++++--------- CHANGELOG.md | 9 ++++++++ pylint_pytest/checkers/class_attr_loader.py | 2 -- pylint_pytest/checkers/fixture.py | 2 -- pyproject.toml | 7 +++---- setup.py | 7 +++---- tox.ini | 2 +- 9 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index f36fc99..257785b 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -12,7 +12,7 @@ on: env: CACHE_VERSION: 1 KEY_PREFIX: base-venv - DEFAULT_PYTHON: '3.11' + DEFAULT_PYTHON: '3.12' PRE_COMMIT_CACHE: ~/.cache/pre-commit concurrency: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 17139ee..5afddc3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: - published env: - DEFAULT_PYTHON: '3.11' + DEFAULT_PYTHON: '3.12' permissions: contents: read diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 656f11f..d6a17d7 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -20,20 +20,22 @@ jobs: - windows-latest - macos-latest python-version: - - '3.6' - - '3.7' - '3.8' - '3.9' - '3.10' - '3.11' - # - '3.12' # FixMe: https://github.com/pylint-dev/pylint-pytest/issues/3 - # Python 3.6 is not available in `ubuntu-latest`. - exclude: - - python-version: '3.6' - os: ubuntu-latest + - '3.12' include: - - python-version: '3.6' - os: ubuntu-20.04 + - python-version: '3.8' + tox_env: py38 + - python-version: '3.9' + tox_env: py39 + - python-version: '3.10' + tox_env: py310 + - python-version: '3.11' + tox_env: py311 + - python-version: '3.12' + tox_env: py312 defaults: run: @@ -61,7 +63,8 @@ jobs: env: FORCE_COLOR: 1 PYTEST_CI_ARGS: --cov-report=xml --cov-report=html --junitxml=test_artifacts/test_report.xml --color=yes - run: tox ${{ matrix.python-version == '3.6' && '--skip-missing-interpreters=true' || '' }} + run: | + tox -e ${{ matrix.tox_env }} - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a62d64..b1b43b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ## [Unreleased] +### Added + +- Support for Python 3.12 (#22) +- Support for Pylint 3 (#22) + +### Removed + +- Support for Python 3.6 & 3.7 (#22) + ## [1.1.3] - 2023-10-23 This is the first release after maintenance was assumed by https://github.com/stdedos. diff --git a/pylint_pytest/checkers/class_attr_loader.py b/pylint_pytest/checkers/class_attr_loader.py index 6c9b4e9..40d16cf 100644 --- a/pylint_pytest/checkers/class_attr_loader.py +++ b/pylint_pytest/checkers/class_attr_loader.py @@ -1,14 +1,12 @@ from typing import Optional, Set from astroid import Assign, Attribute, ClassDef, Name -from pylint.interfaces import IAstroidChecker from ..utils import _can_use_fixture, _is_class_autouse_fixture from . import BasePytestChecker class ClassAttrLoader(BasePytestChecker): - __implements__ = IAstroidChecker msgs = {"E6400": ("", "pytest-class-attr-loader", "")} in_setup = False diff --git a/pylint_pytest/checkers/fixture.py b/pylint_pytest/checkers/fixture.py index 32ec894..374b8a4 100644 --- a/pylint_pytest/checkers/fixture.py +++ b/pylint_pytest/checkers/fixture.py @@ -8,7 +8,6 @@ import pylint import pytest from pylint.checkers.variables import VariablesChecker -from pylint.interfaces import IAstroidChecker from ..utils import ( _can_use_fixture, @@ -42,7 +41,6 @@ def pytest_collectreport(self, report): class FixtureChecker(BasePytestChecker): - __implements__ = IAstroidChecker msgs = { "W6401": ( "Using a deprecated @pytest.yield_fixture decorator", diff --git a/pyproject.toml b/pyproject.toml index 9f4abc8..4dade42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ paths.source = [ ] [tool.mypy] -python_version = "3.7" +python_version = "3.12" check_untyped_defs = true explicit_package_bases = true namespace_packages = true @@ -89,8 +89,7 @@ ignore = [ "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` ] -# py36, but ruff does not support it :/ -target-version = "py37" +target-version = "py312" [tool.ruff.pydocstyle] convention = "google" @@ -113,7 +112,7 @@ convention = "google" [tool.pylint] -py-version = "3.6" +py-version = "3.12" ignore-paths="tests/input" # Ignore test inputs diff --git a/setup.py b/setup.py index f30541f..11fdec2 100755 --- a/setup.py +++ b/setup.py @@ -28,10 +28,10 @@ long_description_content_type="text/markdown", packages=find_packages(exclude=["tests*", "sandbox"]), install_requires=[ - "pylint<3", + "pylint", "pytest>=4.6", ], - python_requires=">=3.6", + python_requires=">=3.8", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -39,12 +39,11 @@ "Topic :: Software Development :: Quality Assurance", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Operating System :: OS Independent", "License :: OSI Approved :: MIT License", diff --git a/tox.ini b/tox.ini index 09dd02e..cd8467c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38,py39,py310,py311 +envlist = py{38,39,310,311,312} skipsdist = True passenv = FORCE_COLOR From 3ab9d5e3cfa5281b84a4cb69776e080c21601979 Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Wed, 25 Oct 2023 13:06:43 +0500 Subject: [PATCH 2/4] fix: review changes --- .github/workflows/run-tests.yaml | 14 ++------------ pyproject.toml | 6 +++--- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index d6a17d7..ded4dfc 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -25,17 +25,6 @@ jobs: - '3.10' - '3.11' - '3.12' - include: - - python-version: '3.8' - tox_env: py38 - - python-version: '3.9' - tox_env: py39 - - python-version: '3.10' - tox_env: py310 - - python-version: '3.11' - tox_env: py311 - - python-version: '3.12' - tox_env: py312 defaults: run: @@ -64,7 +53,8 @@ jobs: FORCE_COLOR: 1 PYTEST_CI_ARGS: --cov-report=xml --cov-report=html --junitxml=test_artifacts/test_report.xml --color=yes run: | - tox -e ${{ matrix.tox_env }} + TOX_ENV=$(echo "py${{ matrix.python-version }}" | tr -d .) + tox -e $TOX_ENV - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 diff --git a/pyproject.toml b/pyproject.toml index 4dade42..010a96e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ paths.source = [ ] [tool.mypy] -python_version = "3.12" +python_version = "3.8" check_untyped_defs = true explicit_package_bases = true namespace_packages = true @@ -89,7 +89,7 @@ ignore = [ "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` ] -target-version = "py312" +target-version = "py38" [tool.ruff.pydocstyle] convention = "google" @@ -112,7 +112,7 @@ convention = "google" [tool.pylint] -py-version = "3.12" +py-version = "3.8" ignore-paths="tests/input" # Ignore test inputs From b97510dca0c270bf78ef398a24bdef2bee1c5ac1 Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Wed, 25 Oct 2023 13:17:17 +0500 Subject: [PATCH 3/4] fix: puting windows tests in todo --- .github/workflows/run-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index ded4dfc..e3a06fb 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -17,7 +17,7 @@ jobs: matrix: os: - ubuntu-latest - - windows-latest + # - windows-latest # TODO: Test on Windows - macos-latest python-version: - '3.8' From d5c61a89fffb9a026cae6d07d912441afd302be4 Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Wed, 25 Oct 2023 14:06:54 +0500 Subject: [PATCH 4/4] fix: tests on windows --- .github/workflows/run-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index e3a06fb..40415aa 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -17,7 +17,7 @@ jobs: matrix: os: - ubuntu-latest - # - windows-latest # TODO: Test on Windows + - windows-latest - macos-latest python-version: - '3.8' @@ -55,6 +55,7 @@ jobs: run: | TOX_ENV=$(echo "py${{ matrix.python-version }}" | tr -d .) tox -e $TOX_ENV + shell: bash - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3