forked from snowflakedb/snowpark-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
124 lines (116 loc) · 4.06 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
[coverage:report]
skip_covered = False
show_missing = True
[coverage:run]
branch = true
parallel = true
[coverage:paths]
source = src/snowflake/snowpark
*/.tox/*/lib/python*/site-packages/snowflake/snowpark
*/.tox\*\Lib\site-packages\snowflake\snowpark
*/src/snowflake/snowpark
*\src\snowflake\snowpark
*/fips_env/lib/python*/site-packages/snowflake/snowpark
[tox]
minversion = 3.7
envlist = fix_lint,
py38,
coverage
skip_missing_interpreters = true
[testenv]
description = run the tests with pytest under {basepython}
deps =
pip >= 19.3.1
.[pandas]
.[development]
install_command = bash ./scripts/tox_install_cmd.sh {opts} {packages}
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-doctest: SNOWFLAKE_TEST_TYPE = (unit or integ or doctest)
!unit-!integ-!doctest: SNOWFLAKE_TEST_TYPE = (unit or integ or doctest)
unit: SNOWFLAKE_TEST_TYPE = unit
integ: SNOWFLAKE_TEST_TYPE = integ
doctest: SNOWFLAKE_TEST_TYPE = doctest
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.snowpark --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 =
notudf: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} and not udf" {posargs:} src/snowflake/snowpark tests
udf: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} or udf" {posargs:} src/snowflake/snowpark tests
notdoctest: {env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} or udf" {posargs:} tests
[testenv:coverage]
description = [run locally after tests]: combine coverage data and create report
deps = {[testenv]deps}
coverage
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
depends = py38
[testenv:flake8]
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
basepython = python3.8
allowlist_externals = /bin/bash
passenv =
PROGRAMDATA
deps =
pre-commit >= 2.9.0
skip_install = True
commands = pre-commit run
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'
[testenv:dev]
description = create dev environment
extras = pandas, development, sso
usedevelop = True
commands = python -m pip list --format=columns
python -c "print(r'{envpython}')"
[pytest]
log_cli = True
log_cli_level = DEBUG
markers =
# Optional dependency groups markers
udf: Snowpark UDF tests
# Test type markers
integ: integration tests
unit: unit tests
doctest: doctest tests
# Other markers
timeout: tests that need a timeout time
addopts = --doctest-modules
[flake8]
# E203: Whitespace before ':'
# E501: Line too long
# W503: Line break occurred before a binary operator
ignore = E203,E501,W503
exclude=
build,.tox,parameters.py,
# Disable checking virtualenv contents
*venv*
max-line-length = 88
show-source = true