0001-misc-add-isort-52937.patch
.pre-commit-config.yaml | ||
---|---|---|
1 | 1 |
# See https://pre-commit.com for more information |
2 | 2 |
# See https://pre-commit.com/hooks.html for more hooks |
3 | 3 |
repos: |
4 | 4 |
- repo: https://github.com/psf/black |
5 | 5 |
rev: 20.8b1 |
6 | 6 |
hooks: |
7 | 7 |
- id: black |
8 | 8 |
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] |
9 |
- repo: https://github.com/PyCQA/isort |
|
10 |
rev: 5.7.0 |
|
11 |
hooks: |
|
12 |
- id: isort |
|
13 |
args: ['--profile', 'black', '--line-length', '110'] |
README | ||
---|---|---|
57 | 57 | |
58 | 58 |
Code Style |
59 | 59 |
---------- |
60 | 60 | |
61 | 61 |
black is used to format the code, using thoses parameters: |
62 | 62 | |
63 | 63 |
black --target-version py37 --skip-string-normalization --line-length 110 |
64 | 64 | |
65 |
isort is used to format the imports, using those parameters: |
|
66 | ||
67 |
isort --profile black --line-length 110 |
|
68 | ||
65 | 69 |
There is .pre-commit-config.yaml to use pre-commit to automatically run black |
66 | 70 |
before commits. (execute `pre-commit install` to install the git hook.) |
67 | 71 | |
72 |
The .git-blame-ignore-revs file could be used to hide the related |
|
73 |
changes into the sources: |
|
74 | ||
75 |
git blame --ignore-revs-file .git-blame-ignore-revs |
|
76 | ||
68 | 77 | |
69 | 78 |
Tests |
70 | 79 |
----- |
71 | 80 | |
72 | 81 |
Unit tests are written using py.test, and its pytest-django support library and |
73 | 82 |
run using tox. |
74 | 83 | |
75 | 84 |
tox |
tox.ini | ||
---|---|---|
1 | 1 |
[tox] |
2 | 2 |
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/{env:BRANCH_NAME:} |
3 |
envlist = py3-django111-black-coverage,py3-django22
|
|
3 |
envlist = py3-django111-codestyle-coverage,py3-django22
|
|
4 | 4 | |
5 | 5 |
[testenv] |
6 | 6 |
usedevelop = True |
7 | 7 |
setenv = |
8 | 8 |
DJANGO_SETTINGS_MODULE=passerelle.settings |
9 | 9 |
PASSERELLE_SETTINGS_FILE=tests/settings.py |
10 | 10 |
BRANCH_NAME={env:BRANCH_NAME:} |
11 | 11 |
WCSCTL=wcs/wcsctl.py |
... | ... | |
32 | 32 |
pytest-httpbin |
33 | 33 |
pytest-localserver |
34 | 34 |
pytest-sftpserver |
35 | 35 |
Quixote>=3.0,<3.2 |
36 | 36 |
vobject |
37 | 37 |
django-ratelimit |
38 | 38 |
pyquery |
39 | 39 |
zeep<3.3 |
40 |
black: pre-commit
|
|
40 |
pre-commit |
|
41 | 41 |
commands = |
42 | 42 |
./get_wcs.sh |
43 | 43 |
py.test {posargs: {env:FAST:} {env:COVERAGE:} {env:JUNIT:} tests/} |
44 | 44 |
coverage: ./pylint.sh passerelle/ |
45 |
black: pre-commit run black --all-files --show-diff-on-failure
|
|
45 |
codestyle: pre-commit run --all-files --show-diff-on-failure
|
|
46 | 46 | |
47 | 47 |
[pytest] |
48 | 48 |
filterwarnings = default |
49 | 49 |
# to delete when using python3, it's a warning inside ElementTree |
50 | 50 |
ignore:.*tree.iter().*:PendingDeprecationWarning |
51 | 51 |
# pyproj warning about deprecation of '+init=authority:code which comes from using Proj(init='EPSG:4326') instead of Proj('EPSG:4326') |
52 | 52 |
# I tried the new syntax but it broke some opengis tests |
53 | 53 |
module:.*init.*authority.*code.*syntax is deprecated:DeprecationWarning:pyproj |
54 |
- |