forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
121 lines (105 loc) · 3.47 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
[tox]
envlist = generate-fixture-yml, linting, doclinting, docbuild, cov-init, py{36,37,38,39}, dbt0{17,18,19,20}-py{37,38}, cov-report, bench, mypy, winpy, dbt0{17,18,19,20}-winpy
[testenv]
passenv = CI CIRCLECI CIRCLE_* HOME
usedevelop = true
allowlist_externals =
make
deps =
# -U keeps all requirements up-to-date
-Urrequirements.txt
-Urrequirements_dev.txt
# Requests is required for the util script
requests
# Add the example plugin
plugins/sqlfluff-plugin-example
# Define dbt versions
dbt017: dbt==0.17.2
dbt018: dbt==0.18.2
dbt019: dbt==0.19.1
dbt020: dbt==0.20.0
# Include any other steps necessary for testing below.
# {posargs} is there to allow us to specify specific tests, which
# can then be invoked from tox by calling e.g.
# tox -e py35 -- project/tests/test_file.py::TestClassName::test_method
commands =
# For the dbt test cases install dependencies.
dbt017,dbt018,dbt019,dbt020: dbt deps --project-dir test/fixtures/dbt/dbt_project
# Clean up from previous tests
python util.py clean-tests
# Run tests
pytest -vv -rs --cov=sqlfluff --cov-report=xml {posargs:-m "not dbt"}
setenv =
COVERAGE_FILE = .coverage.{envname}
# Have option to explictly set TMPDIR for python as on GitHub Action Windows
# machines it doesn't read this from env and resets to system default, which
# is often on different drive (C) from working dir (D), which causes problems.
[testenv:winpy]
setenv =
TMPDIR = temp_pytest
commands =
# For the dbt test cases install dependencies.
dbt017,dbt018,dbt019,dbt020: dbt deps --project-dir test/fixtures/dbt/dbt_project
# Clean up from previous tests
python util.py clean-tests
# Run tests
pytest -vv -rs --cov=sqlfluff --cov-report=xml {posargs:-m "not dbt"}
[testenv:cov-init]
setenv =
COVERAGE_FILE = .coverage
commands =
coverage erase
[testenv:bench]
commands =
python util.py benchmark -f benchmarks/benchmarks.yml
[testenv:cov-report]
setenv =
COVERAGE_FILE = .coverage
commands =
coverage combine
# Exclude dbt templater by default as those tests do not run without dbt
coverage report --fail-under=100 --show-missing --omit "*templaters/dbt.py,*/dbt_templater/*"
# Have copy of above for full coverage - including dbt - for those that want it
[testenv:cov-report-dbt]
setenv =
COVERAGE_FILE = .coverage
commands =
coverage combine
coverage report --fail-under=100 --show-missing
[testenv:generate-fixture-yml]
commands = python test/generate_parse_fixture_yml.py
[testenv:linting]
commands = flake8
[testenv:doclinting]
commands = doc8 docs/source --file-encoding utf8
[testenv:docbuild]
deps =
# -U keeps all requirements up-to-date
-Urdocs/requirements.txt
commands = make -C docs html
[testenv:mypy]
commands = mypy src/sqlfluff
[flake8]
# Ignore:
# W503: Line breaks before binary operators
# D107: Don't require docstrings on __init__
# D105: Don't require docstrings on magic methods
ignore = W503, D107, D105, D418
exclude = .git,__pycache__,env,.tox,build,.venv,venv
max-line-length = 127
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
# sqlfluff uses flake8-docstrings https://pypi.org/project/flake8-docstrings/
# this is to assist with the sphinx based autodoc
docstring-convention = google
[pytest]
python_files = *_test.py
testpaths = test
[coverage:run]
source = src/sqlfluff
omit = src/sqlfluff/__main__.py
[coverage:report]
exclude_lines =
sys.version_info
pragma: no cover