Skip to content

Commit 2f26141

Browse files
authored
Merge pull request #21 from dineshtrivedi/20
20 - AttributeError: Can't pickle local object 'augment_visit.<locals>.augment_func'
2 parents ed4540e + 17cbb58 commit 2f26141

18 files changed

+638
-118
lines changed

.coveragerc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
[paths]
2+
source =
3+
pylint_plugin_utils
14

2-
[run]
3-
source=pylint_plugin_utils
5+
[report]
6+
include =
7+
pylint_plugin_utils/*
8+
omit =
9+
*/test/*
10+
exclude_lines =
11+
# Re-enable default pragma
12+
pragma: no cover
13+
14+
# Debug-only code
15+
def __repr__
16+
17+
# Type checking code not executed during pytest runs
18+
if TYPE_CHECKING:
19+
@overload

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
ignore =
3+
E203, W503, # Incompatible with black see https://github.com/ambv/black/issues/315
4+
5+
max-line-length=88
6+
max-complexity=39

.github/workflows/ci.yaml

Lines changed: 349 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,349 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
env:
6+
CACHE_VERSION: 3
7+
DEFAULT_PYTHON: 3.8
8+
PRE_COMMIT_CACHE: ~/.cache/pre-commit
9+
10+
jobs:
11+
prepare-base:
12+
name: Prepare base dependencies
13+
runs-on: ubuntu-latest
14+
outputs:
15+
python-key: ${{ steps.generate-python-key.outputs.key }}
16+
pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }}
17+
steps:
18+
- name: Check out code from GitHub
19+
uses: actions/checkout@v2.4.0
20+
with:
21+
fetch-depth: 0
22+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
23+
id: python
24+
uses: actions/setup-python@v2.3.1
25+
with:
26+
python-version: ${{ env.DEFAULT_PYTHON }}
27+
- name: Generate partial Python venv restore key
28+
id: generate-python-key
29+
run: >-
30+
echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{
31+
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt')
32+
}}"
33+
- name: Restore Python virtual environment
34+
id: cache-venv
35+
uses: actions/cache@v2.1.7
36+
with:
37+
path: venv
38+
key: >-
39+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
40+
steps.generate-python-key.outputs.key }}
41+
restore-keys: |
42+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-
43+
- name: Create Python virtual environment
44+
if: steps.cache-venv.outputs.cache-hit != 'true'
45+
run: |
46+
python -m venv venv
47+
. venv/bin/activate
48+
python -m pip install -U pip setuptools wheel
49+
pip install -U -r requirements_test.txt
50+
- name: Generate pre-commit restore key
51+
id: generate-pre-commit-key
52+
run: >-
53+
echo "::set-output name=key::pre-commit-${{ env.CACHE_VERSION }}-${{
54+
hashFiles('.pre-commit-config.yaml') }}"
55+
- name: Restore pre-commit environment
56+
id: cache-precommit
57+
uses: actions/cache@v2.1.7
58+
with:
59+
path: ${{ env.PRE_COMMIT_CACHE }}
60+
key: >-
61+
${{ runner.os }}-${{ steps.generate-pre-commit-key.outputs.key }}
62+
restore-keys: |
63+
${{ runner.os }}-pre-commit-${{ env.CACHE_VERSION }}-
64+
- name: Install pre-commit dependencies
65+
if: steps.cache-precommit.outputs.cache-hit != 'true'
66+
run: |
67+
. venv/bin/activate
68+
pre-commit install --install-hooks
69+
70+
prepare-tests-linux:
71+
name: Prepare tests for Python ${{ matrix.python-version }} (Linux)
72+
runs-on: ubuntu-latest
73+
strategy:
74+
matrix:
75+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
76+
outputs:
77+
python-key: ${{ steps.generate-python-key.outputs.key }}
78+
steps:
79+
- name: Check out code from GitHub
80+
uses: actions/checkout@v2.4.0
81+
with:
82+
fetch-depth: 0
83+
- name: Set up Python ${{ matrix.python-version }}
84+
id: python
85+
uses: actions/setup-python@v2.3.1
86+
with:
87+
python-version: ${{ matrix.python-version }}
88+
- name: Generate partial Python venv restore key
89+
id: generate-python-key
90+
run: >-
91+
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
92+
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt')
93+
}}"
94+
- name: Restore Python virtual environment
95+
id: cache-venv
96+
uses: actions/cache@v2.1.7
97+
with:
98+
path: venv
99+
key: >-
100+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
101+
steps.generate-python-key.outputs.key }}
102+
restore-keys: |
103+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
104+
- name: Create Python virtual environment
105+
if: steps.cache-venv.outputs.cache-hit != 'true'
106+
run: |
107+
python -m venv venv
108+
. venv/bin/activate
109+
python -m pip install -U pip setuptools wheel
110+
pip install -U -r requirements_test.txt
111+
112+
pytest-linux:
113+
name: Run tests Python ${{ matrix.python-version }} (Linux)
114+
runs-on: ubuntu-latest
115+
needs: prepare-tests-linux
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
120+
steps:
121+
- name: Check out code from GitHub
122+
uses: actions/checkout@v2.4.0
123+
- name: Set up Python ${{ matrix.python-version }}
124+
id: python
125+
uses: actions/setup-python@v2.3.1
126+
with:
127+
python-version: ${{ matrix.python-version }}
128+
- name: Restore Python virtual environment
129+
id: cache-venv
130+
uses: actions/cache@v2.1.7
131+
with:
132+
path: venv
133+
key:
134+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
135+
needs.prepare-tests-linux.outputs.python-key }}
136+
- name: Fail job if Python cache restore failed
137+
if: steps.cache-venv.outputs.cache-hit != 'true'
138+
run: |
139+
echo "Failed to restore Python venv from cache"
140+
exit 1
141+
- name: Run pytest
142+
run: |
143+
. venv/bin/activate
144+
pytest --cov --cov-report= tests/
145+
- name: Upload coverage artifact
146+
uses: actions/upload-artifact@v2.3.1
147+
with:
148+
name: coverage-${{ matrix.python-version }}
149+
path: .coverage
150+
151+
coverage:
152+
name: Process test coverage
153+
runs-on: ubuntu-latest
154+
needs: ["prepare-tests-linux", "pytest-linux"]
155+
strategy:
156+
matrix:
157+
python-version: [3.8]
158+
env:
159+
COVERAGERC_FILE: .coveragerc
160+
steps:
161+
- name: Check out code from GitHub
162+
uses: actions/checkout@v2.4.0
163+
- name: Set up Python ${{ matrix.python-version }}
164+
id: python
165+
uses: actions/setup-python@v2.3.1
166+
with:
167+
python-version: ${{ matrix.python-version }}
168+
- name: Restore Python virtual environment
169+
id: cache-venv
170+
uses: actions/cache@v2.1.7
171+
with:
172+
path: venv
173+
key:
174+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
175+
needs.prepare-tests-linux.outputs.python-key }}
176+
- name: Fail job if Python cache restore failed
177+
if: steps.cache-venv.outputs.cache-hit != 'true'
178+
run: |
179+
echo "Failed to restore Python venv from cache"
180+
exit 1
181+
- name: Download all coverage artifacts
182+
uses: actions/download-artifact@v2.1.0
183+
- name: Combine coverage results
184+
run: |
185+
. venv/bin/activate
186+
coverage combine coverage*/.coverage
187+
coverage report --rcfile=${{ env.COVERAGERC_FILE }}
188+
- name: Upload coverage to Coveralls
189+
env:
190+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
191+
run: |
192+
. venv/bin/activate
193+
coveralls --rcfile=${{ env.COVERAGERC_FILE }} --service=github
194+
195+
prepare-tests-windows:
196+
name: Prepare tests for Python ${{ matrix.python-version }} (Windows)
197+
runs-on: windows-latest
198+
strategy:
199+
matrix:
200+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
201+
outputs:
202+
python-key: ${{ steps.generate-python-key.outputs.key }}
203+
steps:
204+
- name: Check out code from GitHub
205+
uses: actions/checkout@v2.4.0
206+
with:
207+
fetch-depth: 0
208+
- name: Set up Python ${{ matrix.python-version }}
209+
id: python
210+
uses: actions/setup-python@v2.3.1
211+
with:
212+
python-version: ${{ matrix.python-version }}
213+
- name: Generate partial Python venv restore key
214+
id: generate-python-key
215+
run: >-
216+
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
217+
hashFiles('setup.cfg', 'requirements_test_min.txt')
218+
}}"
219+
- name: Restore Python virtual environment
220+
id: cache-venv
221+
uses: actions/cache@v2.1.7
222+
with:
223+
path: venv
224+
key: >-
225+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
226+
steps.generate-python-key.outputs.key }}
227+
restore-keys: |
228+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
229+
- name: Create Python virtual environment
230+
if: steps.cache-venv.outputs.cache-hit != 'true'
231+
run: |
232+
python -m venv venv
233+
. venv\\Scripts\\activate
234+
python -m pip install -U pip setuptools wheel
235+
pip install -U -r requirements_test_min.txt
236+
237+
pytest-windows:
238+
name: Run tests Python ${{ matrix.python-version }} (Windows)
239+
runs-on: windows-latest
240+
needs: prepare-tests-windows
241+
strategy:
242+
fail-fast: false
243+
matrix:
244+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
245+
steps:
246+
- name: Set temp directory
247+
run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
248+
# Workaround to set correct temp directory on Windows
249+
# https://github.com/actions/virtual-environments/issues/712
250+
- name: Check out code from GitHub
251+
uses: actions/checkout@v2.4.0
252+
- name: Set up Python ${{ matrix.python-version }}
253+
id: python
254+
uses: actions/setup-python@v2.3.1
255+
with:
256+
python-version: ${{ matrix.python-version }}
257+
- name: Restore Python virtual environment
258+
id: cache-venv
259+
uses: actions/cache@v2.1.7
260+
with:
261+
path: venv
262+
key:
263+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
264+
needs.prepare-tests-windows.outputs.python-key }}
265+
- name: Fail job if Python cache restore failed
266+
if: steps.cache-venv.outputs.cache-hit != 'true'
267+
run: |
268+
echo "Failed to restore Python venv from cache"
269+
exit 1
270+
- name: Run pytest
271+
run: |
272+
. venv\\Scripts\\activate
273+
pytest tests/
274+
275+
prepare-tests-pypy:
276+
name: Prepare tests for Python ${{ matrix.python-version }}
277+
runs-on: ubuntu-latest
278+
strategy:
279+
matrix:
280+
python-version: ["pypy3"]
281+
outputs:
282+
python-key: ${{ steps.generate-python-key.outputs.key }}
283+
steps:
284+
- name: Check out code from GitHub
285+
uses: actions/checkout@v2.4.0
286+
with:
287+
fetch-depth: 0
288+
- name: Set up Python ${{ matrix.python-version }}
289+
id: python
290+
uses: actions/setup-python@v2.3.1
291+
with:
292+
python-version: ${{ matrix.python-version }}
293+
- name: Generate partial Python venv restore key
294+
id: generate-python-key
295+
run: >-
296+
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{
297+
hashFiles('setup.cfg', 'requirements_test_min.txt')
298+
}}"
299+
- name: Restore Python virtual environment
300+
id: cache-venv
301+
uses: actions/cache@v2.1.7
302+
with:
303+
path: venv
304+
key: >-
305+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
306+
steps.generate-python-key.outputs.key }}
307+
restore-keys: |
308+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-
309+
- name: Create Python virtual environment
310+
if: steps.cache-venv.outputs.cache-hit != 'true'
311+
run: |
312+
python -m venv venv
313+
. venv/bin/activate
314+
python -m pip install -U pip setuptools wheel
315+
pip install -U -r requirements_test_min.txt
316+
317+
pytest-pypy:
318+
name: Run tests Python ${{ matrix.python-version }}
319+
runs-on: ubuntu-latest
320+
needs: prepare-tests-pypy
321+
strategy:
322+
fail-fast: false
323+
matrix:
324+
python-version: ["pypy3"]
325+
steps:
326+
- name: Check out code from GitHub
327+
uses: actions/checkout@v2.4.0
328+
- name: Set up Python ${{ matrix.python-version }}
329+
id: python
330+
uses: actions/setup-python@v2.3.1
331+
with:
332+
python-version: ${{ matrix.python-version }}
333+
- name: Restore Python virtual environment
334+
id: cache-venv
335+
uses: actions/cache@v2.1.7
336+
with:
337+
path: venv
338+
key:
339+
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
340+
needs.prepare-tests-pypy.outputs.python-key }}
341+
- name: Fail job if Python cache restore failed
342+
if: steps.cache-venv.outputs.cache-hit != 'true'
343+
run: |
344+
echo "Failed to restore Python venv from cache"
345+
exit 1
346+
- name: Run pytest
347+
run: |
348+
. venv/bin/activate
349+
pytest tests/

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ pip-log.txt
2525
.coverage
2626
.tox
2727
nosetests.xml
28+
.pytest_cache
29+
.benchmarks
30+
htmlcov
2831

2932
# Translations
3033
*.mo
@@ -33,3 +36,5 @@ nosetests.xml
3336
.mr.developer.cfg
3437
.project
3538
.pydevproject
39+
.pylint-plugin-utils
40+
.idea

0 commit comments

Comments
 (0)