Skip to content

Commit 8e41c8a

Browse files
authored
Merge pull request #9 from bnavigator/py39-folding
TST: accept folding of decorator parameters in Python 3.9
2 parents 1833875 + 2d3c52c commit 8e41c8a

File tree

5 files changed

+52
-17
lines changed

5 files changed

+52
-17
lines changed

.github/workflows/static.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Static code analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
pull_request:
9+
branches:
10+
- '*'
11+
12+
jobs:
13+
build:
14+
name: Static code analysis
15+
runs-on: ubuntu-latest
16+
env:
17+
CI: 'true'
18+
OS: 'linux'
19+
timeout-minutes: 2
20+
steps:
21+
- uses: actions/cache@v1
22+
with:
23+
path: ~/.cache/pip
24+
key: static-pip-${{ hashFiles('setup.py') }}
25+
restore-keys: static-pip-
26+
- uses: actions/checkout@v2
27+
- uses: actions/setup-python@v2
28+
with:
29+
# TODO: check with Python 3, but need to fix the
30+
# errors first
31+
python-version: '2.7'
32+
architecture: 'x64'
33+
- run: python -m pip install --upgrade pip setuptools
34+
- run: pip install -e .[pylint,pycodestyle,pyflakes]
35+
- name: Pylint checks
36+
run: pylint pyls test
37+
- name: Code style checks
38+
run: pycodestyle pyls test
39+
- name: Pyflakes checks
40+
run: pyflakes pyls test

.github/workflows/test-linux.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
23+
PYTHON_VERSION: ['3.9', '3.8', '3.7', '3.6', '2.7']
2424
timeout-minutes: 10
2525
steps:
2626
- uses: actions/cache@v1
@@ -40,13 +40,4 @@ jobs:
4040
/tmp/pyenv/bin/python -m pip install loghub
4141
- run: python -m pip install --upgrade pip setuptools
4242
- run: pip install -e .[all,test]
43-
- run: py.test -v test/
44-
- name: Pylint checks
45-
if: matrix.PYTHON_VERSION == '2.7'
46-
run: pylint pyls test
47-
- name: Code style checks
48-
if: matrix.PYTHON_VERSION == '2.7'
49-
run: pycodestyle pyls test
50-
- name: Pyflakes checks
51-
if: matrix.PYTHON_VERSION == '2.7'
52-
run: pyflakes pyls test
43+
- run: pytest -v test/

.github/workflows/test-mac.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
23+
PYTHON_VERSION: ['3.9', '3.8', '3.7', '3.6', '2.7']
2424
timeout-minutes: 10
2525
steps:
2626
- uses: actions/cache@v1
@@ -40,4 +40,4 @@ jobs:
4040
/tmp/pyenv/bin/python -m pip install loghub
4141
- run: python -m pip install --upgrade pip setuptools
4242
- run: pip install -e .[all,test]
43-
- run: py.test -v test/
43+
- run: pytest -v test/

.github/workflows/test-win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
PYTHON_VERSION: ['3.8', '3.7', '3.6', '2.7']
23+
PYTHON_VERSION: ['3.9', '3.8', '3.7', '3.6', '2.7']
2424
timeout-minutes: 10
2525
steps:
2626
- uses: actions/cache@v1
@@ -35,4 +35,4 @@ jobs:
3535
architecture: 'x64'
3636
- run: python -m pip install --upgrade pip setuptools
3737
- run: pip install -e .[all,test]
38-
- run: py.test -v test/
38+
- run: pytest -v test/

test/plugins/test_folding.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright 2019 Palantir Technologies, Inc.
22

3+
import sys
34
from textwrap import dedent
45

56
from pyls import uris
6-
from pyls.workspace import Document
77
from pyls.plugins.folding import pyls_folding_range
8-
8+
from pyls.workspace import Document
99

1010
DOC_URI = uris.from_fs_path(__file__)
1111
DOC = dedent("""
@@ -146,6 +146,10 @@ def test_folding(workspace):
146146
{'startLine': 62, 'endLine': 63},
147147
{'startLine': 64, 'endLine': 65},
148148
{'startLine': 67, 'endLine': 68}]
149+
if sys.version_info[:2] >= (3, 9):
150+
# the argument list of the decorator is also folded in Python >= 3.9
151+
expected.insert(4, {'startLine': 9, 'endLine': 10})
152+
149153
assert ranges == expected
150154

151155

0 commit comments

Comments
 (0)