From 45ff79d74ac89e5b52c673e7042c160fcd0e5003 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Thu, 1 Apr 2021 21:52:39 +0200 Subject: [PATCH 1/2] TST: Add Python 3.9 to GHA test matrix --- .github/workflows/static.yml | 40 ++++++++++++++++++++++++++++++++ .github/workflows/test-linux.yml | 13 ++--------- .github/workflows/test-mac.yml | 4 ++-- .github/workflows/test-win.yml | 4 ++-- 4 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 00000000..bae3cca7 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,40 @@ +name: Static code analysis + +on: + push: + branches: + - develop + + pull_request: + branches: + - '*' + +jobs: + build: + name: Static code analysis + runs-on: ubuntu-latest + env: + CI: 'true' + OS: 'linux' + timeout-minutes: 2 + steps: + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: static-pip-${{ hashFiles('setup.py') }} + restore-keys: static-pip- + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + # TODO: check with Python 3, but need to fix the + # errors first + python-version: '2.7' + architecture: 'x64' + - run: python -m pip install --upgrade pip setuptools + - run: pip install -e .[pylint,pycodestyle,pyflakes] + - name: Pylint checks + run: pylint pyls test + - name: Code style checks + run: pycodestyle pyls test + - name: Pyflakes checks + run: pyflakes pyls test diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index eab616bf..cdd8b07c 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7'] + PYTHON_VERSION: ['3.9', '3.8', '3.7', '3.6', '2.7'] timeout-minutes: 10 steps: - uses: actions/cache@v1 @@ -40,13 +40,4 @@ jobs: /tmp/pyenv/bin/python -m pip install loghub - run: python -m pip install --upgrade pip setuptools - run: pip install -e .[all,test] - - run: py.test -v test/ - - name: Pylint checks - if: matrix.PYTHON_VERSION == '2.7' - run: pylint pyls test - - name: Code style checks - if: matrix.PYTHON_VERSION == '2.7' - run: pycodestyle pyls test - - name: Pyflakes checks - if: matrix.PYTHON_VERSION == '2.7' - run: pyflakes pyls test + - run: pytest -v test/ diff --git a/.github/workflows/test-mac.yml b/.github/workflows/test-mac.yml index 22b95373..b17b72a0 100644 --- a/.github/workflows/test-mac.yml +++ b/.github/workflows/test-mac.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7'] + PYTHON_VERSION: ['3.9', '3.8', '3.7', '3.6', '2.7'] timeout-minutes: 10 steps: - uses: actions/cache@v1 @@ -40,4 +40,4 @@ jobs: /tmp/pyenv/bin/python -m pip install loghub - run: python -m pip install --upgrade pip setuptools - run: pip install -e .[all,test] - - run: py.test -v test/ + - run: pytest -v test/ diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index 2deae4fb..03032ae1 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7'] + PYTHON_VERSION: ['3.9', '3.8', '3.7', '3.6', '2.7'] timeout-minutes: 10 steps: - uses: actions/cache@v1 @@ -35,4 +35,4 @@ jobs: architecture: 'x64' - run: python -m pip install --upgrade pip setuptools - run: pip install -e .[all,test] - - run: py.test -v test/ + - run: pytest -v test/ From 2d3c52c7b9debd73073650d22a3aa6e86d5491aa Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Thu, 1 Apr 2021 21:33:38 +0200 Subject: [PATCH 2/2] TST: accept folding of decorator parameters in Python 3.9 --- test/plugins/test_folding.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/plugins/test_folding.py b/test/plugins/test_folding.py index 05f0cdd8..91ac0f3b 100644 --- a/test/plugins/test_folding.py +++ b/test/plugins/test_folding.py @@ -1,11 +1,11 @@ # Copyright 2019 Palantir Technologies, Inc. +import sys from textwrap import dedent from pyls import uris -from pyls.workspace import Document from pyls.plugins.folding import pyls_folding_range - +from pyls.workspace import Document DOC_URI = uris.from_fs_path(__file__) DOC = dedent(""" @@ -146,6 +146,10 @@ def test_folding(workspace): {'startLine': 62, 'endLine': 63}, {'startLine': 64, 'endLine': 65}, {'startLine': 67, 'endLine': 68}] + if sys.version_info[:2] >= (3, 9): + # the argument list of the decorator is also folded in Python >= 3.9 + expected.insert(4, {'startLine': 9, 'endLine': 10}) + assert ranges == expected