diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 06042df..16856fa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,14 +21,14 @@ jobs: fetch-depth: 0 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Generate partial Python venv restore key id: generate-python-key run: >- echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') + hashFiles('poetry.lock', 'pyproject.toml') }}" - name: Restore Python virtual environment id: cache-venv @@ -45,8 +45,8 @@ jobs: run: | python -m venv venv . venv/bin/activate - python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test.txt + python -m pip install -U pip poetry + poetry install - name: Generate pre-commit restore key id: generate-pre-commit-key run: >- @@ -72,7 +72,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: @@ -82,14 +82,14 @@ jobs: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Generate partial Python venv restore key id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') + hashFiles('poetry.lock', 'pyproject.toml') }}" - name: Restore Python virtual environment id: cache-venv @@ -106,8 +106,8 @@ jobs: run: | python -m venv venv . venv/bin/activate - python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test.txt + python -m pip install -U pip poetry + poetry install pytest-linux: name: Run tests Python ${{ matrix.python-version }} (Linux) @@ -116,13 +116,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] steps: - name: Check out code from GitHub uses: actions/checkout@v2.4.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment @@ -162,7 +162,7 @@ jobs: uses: actions/checkout@v2.4.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment @@ -197,7 +197,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: @@ -207,14 +207,14 @@ jobs: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Generate partial Python venv restore key id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') + hashFiles('poetry.lock', 'pyproject.toml') }}" - name: Restore Python virtual environment id: cache-venv @@ -231,8 +231,8 @@ jobs: run: | python -m venv venv . venv\\Scripts\\activate - python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test_min.txt + python -m pip install -U pip poetry + poetry install pytest-windows: name: Run tests Python ${{ matrix.python-version }} (Windows) @@ -241,7 +241,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] steps: - name: Set temp directory run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV @@ -251,7 +251,7 @@ jobs: uses: actions/checkout@v2.4.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment @@ -277,7 +277,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["pypy3"] + python-version: ["pypy3.7", "pypy3.8", "pypy3.9"] outputs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: @@ -287,14 +287,14 @@ jobs: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Generate partial Python venv restore key id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') + hashFiles('poetry.lock', 'pyproject.toml') }}" - name: Restore Python virtual environment id: cache-venv @@ -311,8 +311,8 @@ jobs: run: | python -m venv venv . venv/bin/activate - python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test_min.txt + python -m pip install -U pip poetry + poetry install pytest-pypy: name: Run tests Python ${{ matrix.python-version }} @@ -321,13 +321,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy3"] + python-version: ["pypy3.7", "pypy3.8", "pypy3.9"] steps: - name: Check out code from GitHub uses: actions/checkout@v2.4.0 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment diff --git a/README.md b/README.md index 1c5497e..ae337fc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Utilities and helpers for writing Pylint plugins. This is not a direct Pylint pl # Testing Create virtualenv: ```bash -python3.8 -m venv .pylint-plugin-utils +python3.8 -m venv .pylint-plugin-utils source .pylint-plugin-utils/bin/activate pip install --upgrade pip setuptools ``` diff --git a/tests/test_linter_pickle.py b/tests/test_linter_pickle.py index 692feed..e0dab37 100644 --- a/tests/test_linter_pickle.py +++ b/tests/test_linter_pickle.py @@ -1,5 +1,6 @@ import pickle +import pylint from pylint.checkers.typecheck import TypeChecker from pylint_plugin_utils import augment_visit, suppress_message @@ -14,18 +15,18 @@ def fake_suppress_func(*args, **kwargs): def test_linter_should_be_pickleable(linter): + # after pylint>=2.13, dill is used in pylint - + # see discussion https://github.com/PyCQA/pylint-plugin-utils/issues/26 + # therefore we can ignore that test, as the previous reasons for this + # test no longer exist + # (reason was https://github.com/PyCQA/pylint-plugin-utils/issues/20) + if pylint.__version__ >= "2.13": + return + # Setup linter.register_checker(TypeChecker()) augment_visit(linter, TypeChecker.visit_attribute, fake_augmentation_func) suppress_message(linter, TypeChecker.visit_attribute, "no-member", fake_suppress_func) # Act and Assert - try: - pickle.dumps(linter) - except TypeError: - # this can happen for newer versions of pylint (>2.12) which now use dill for pickling - import dill - - # this import will fail for earlier versions which do not have dill as a dependency, - # in which case this is an old version which also does not pickle - dill.dumps(linter) + pickle.dumps(linter)