forked from snowflakedb/snowflake-connector-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
190 lines (179 loc) · 6.44 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
[coverage:report]
skip_covered = False
show_missing = True
[coverage:run]
branch = true
parallel = true
omit = */snowflake/connector/tool/*
*/snowflake/connector/vendored/*
src/snowflake/connector/incident.py
[coverage:paths]
source = src/snowflake/connector
*/.tox/*/lib/python*/site-packages/snowflake/connector
*/.tox\*\Lib\site-packages\snowflake\connector
*/src/snowflake/connector
*\src\snowflake\connector
*/fips_env/lib/python*/site-packages/snowflake/connector
[tox]
minversion = 3.7
envlist = fix_lint,
py{37,38,39,310}-{unit-parallel,integ,pandas,sso},
coverage
skip_missing_interpreters = true
requires =
tox-external-wheels>=0.1.6
[testenv]
description = run the tests with pytest under {basepython}
extras =
development
pandas: pandas
sso: secure-local-storage
deps =
pip >= 19.3.1
install_command = python -m pip install -U {opts} {packages}
external_wheels =
py37-ci: dist/*cp37*.whl
py38-ci: dist/*cp38*.whl
py39-ci: dist/*cp39*.whl
py310-ci: dist/*cp310*.whl
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
ci: SNOWFLAKE_PYTEST_OPTS = -vvv
# Set test type, either notset, unit, integ, or both
unit-integ: SNOWFLAKE_TEST_TYPE = (unit or integ)
!unit-!integ: SNOWFLAKE_TEST_TYPE = (unit or integ)
unit: SNOWFLAKE_TEST_TYPE = unit
integ: SNOWFLAKE_TEST_TYPE = integ
parallel: SNOWFLAKE_PYTEST_OPTS = {env:SNOWFLAKE_PYTEST_OPTS:} -n auto
# Add common parts into pytest command
SNOWFLAKE_PYTEST_COV_LOCATION = {env:JUNIT_REPORT_DIR:{toxworkdir}}/junit.{envname}-{env:cloud_provider:dev}.xml
SNOWFLAKE_PYTEST_COV_CMD = --cov snowflake.connector --junitxml {env:SNOWFLAKE_PYTEST_COV_LOCATION} --cov-report=
SNOWFLAKE_PYTEST_CMD = pytest {env:SNOWFLAKE_PYTEST_OPTS:} {env:SNOWFLAKE_PYTEST_COV_CMD}
passenv =
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
SF_PROJECT_ROOT
cloud_provider
SF_REGRESS_LOGS
; Github Actions provided environmental variables
GITHUB_ACTIONS
JENKINS_HOME
; This is required on windows. Otherwise pwd module won't be imported successfully,
; see https://github.com/tox-dev/tox/issues/1455
USERNAME
CLIENT_LOG_DIR_PATH_DOCKER
PYTEST_ADDOPTS
commands =
# Test environments
# Note: make sure to have a default env and all the other special ones
!pandas-!sso-!lambda: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and not sso and not pandas and not lambda" {posargs:} test
pandas: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and pandas" {posargs:} test
sso: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and sso" {posargs:} test
lambda: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and lambda" {posargs:} test
[testenv:olddriver]
basepython = python3.7
description = run the old driver tests with pytest under {basepython}
deps =
pip >= 19.3.1
snowflake-connector-python==1.9.1
azure-storage-blob==2.1.0
pandas
pendulum!=2.1.1
pytest<6.1.0
pytest-cov
pytest-rerunfailures
pytest-timeout
pytest-xdist
mock
skip_install = True
setenv = {[testenv]setenv}
passenv = {[testenv]passenv}
commands =
{env:SNOWFLAKE_PYTEST_CMD} -m "not skipolddriver" -vvv {posargs:} test
[testenv:coverage]
description = [run locally after tests]: combine coverage data and create report
; generates a diff coverage against origin/master (can be changed by setting DIFF_AGAINST env var)
deps = {[testenv]deps}
coverage
; diff_cover
skip_install = True
passenv = DIFF_AGAINST
setenv = COVERAGE_FILE={toxworkdir}/.coverage
commands = coverage combine
coverage report -m
coverage xml -o {env:COV_REPORT_DIR:{toxworkdir}}/coverage.xml
coverage html -d {env:COV_REPORT_DIR:{toxworkdir}}/htmlcov
; diff-cover --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml
depends = py37, py38, py39, py310
[testenv:py{37,38,39,310}-coverage]
# I hate doing this, but this env is for Jenkins, please keep it up-to-date with the one env above it if necessary
description = [run locally after tests]: combine coverage data and create report specifically with {basepython}
deps = {[testenv:coverage]deps}
skip_install = {[testenv:coverage]skip_install}
passenv = {[testenv:coverage]passenv}
setenv = {[testenv:coverage]setenv}
commands = {[testenv:coverage]commands}
depends = {[testenv:coverage]depends}
[testenv:flake8]
; DEPRECATED
description = check code style with flake8
skip_install = true
deps = flake8
commands = flake8 {posargs}
[testenv:fix_lint]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
passenv =
PROGRAMDATA
deps =
{[testenv]deps}
pre-commit >= 2.9.0
skip_install = True
commands = pre-commit run --all-files
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'
[testenv:dependency]
description = Check if there is conflicting dependency
deps =
{[testenv]deps}
pip-tools
skip_install = True
commands = pip-compile setup.py
depends = py37, py38, py39, py310
[pytest]
log_level = info
addopts = -ra --strict-markers
junit_family = legacy
markers =
# Optional dependency groups markers
lambda: AWS lambda tests
pandas: tests for pandas integration
sso: tests for sso optional dependency integration
# Cloud provider markers
aws: tests for Amazon Cloud storage
azure: tests for Azure Cloud storage
gcp: tests for Google Cloud storage
# Test type markers
integ: integration tests
unit: unit tests
skipolddriver: skip for old driver tests
# Other markers
timeout: tests that need a timeout time
internal: tests that could but should only run on our internal CI
external: tests that could but should only run on our external CI
[isort]
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 88
known_first_party =snowflake,parameters,generate_test_files
[flake8]
# Notes on ignores:
# - all ignored Ds mean doc issues, these should be cleaned up
ignore = B011,C901,D100,D101,D102,D103,D104,D105,D107,D401,E203,E402,E501,F821,W503
exclude=
build,tool,.tox,parameters.py,parameters_jenkins.py,
# Disable checking virtualenv contents
*venv*
max-line-length = 88
show-source = true