Repository navigation
Expand file tree
/
Copy pathtox.ini
More file actions
102 lines (87 loc) · 3.36 KB
/
Copy pathtox.ini
File metadata and controls
102 lines (87 loc) · 3.36 KB
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
[tox]
# py will use whatever the basepython `python` maps to from PATH
# you can use py38, for example, to chosse a different version
# See https://tox.readthedocs.io/en/latest/config.html#tox-environments
envlist = py, cpu, gpu, spark, all
# Default env settings
[testenv]
# similar to 'pip install <PAKCGE_NAME>-*.whl[all]'
extras = all
commands =
# {posargs} will be substituded by arguments after the `--` when running.
# This will allow running subset of the test suite via tox.
#
# EX: tox -- -m "not spark and not gpu"
# will pass {-m "not spark and not gpu"} to `pytest`
# See https://tox.readthedocs.io/en/latest/example/general.html for more details
pytest {posargs}
[testenv:cpu]
# i.e: 'pip install <PAKCGE_NAME>-*.whl[dev,examples]'
# with this dependency subset, we should be able to run the test markers:
# 1. "not notebooks and not spark and not gpu" (tests for general sdk utilities)
# 2. "notebooks and not spark and not gpu" (tests for notebook example without extra dependencies)
extras = dev,examples
[testenv:gpu]
# i.e: 'pip install <PAKCGE_NAME>-*.whl[dev,gpu,examples]'
# with this dependency subset, we should be able to run the test markers:
# 1. "gpu and not notebook and not spark" (tests for gpu utilities)
# 2. "gpu and notebooks and not spark" (tests for notebooks needing gpu resources)
extras = dev,gpu,examples
[testenv:spark]
# i.e: 'pip install <PAKCGE_NAME>-*.whl[dev,spark,examples]'
# with this dependency subset, we should be able to run the test markers:
# 1. "spark and not notebook and not spark" (test for spark utilities)
# 2. "spark and notebooks and not spark" (tests for notebook using spark)
extras = dev,spark,examples
# We will need to redefine the following envrionment var in tox
setenv =
PYSPARK_DRIVER_PYTHON = {envpython}
PYSPARK_PYTHON = {envpython}
[testenv:all]
# i.e: 'pip install <PAKCGE_NAME>-*.whl[all]'
# with this, we should be able to run ANY tests
extras = all
[testenv:flake8]
deps = flake8
skip_install = True
commands = flake8 .
# Configurations for running pytest
[pytest]
log_cli = False
log_format = %(asctime)s %(levelname)s %(message)s
junit_family = xunit2
# This enable custom marker as decorator "@pytest.mark.gpu"
markers =
# markers allow to us to run faster subset of the test:
# EX: pytest -m "not spark and not gpu"
# See https://docs.pytest.org/en/stable/example/markers.html#registering-markers
notebooks: mark a test as notebooks test
gpu: mark a test as gpu test
spark: mark a test as spark test
testpaths =
tests
addopts =
# reports all (except passed tests). See https://docs.pytest.org/en/latest/usage.html#detailed-summary-report
# TODO: please don't forget to replace <PACKAGE_NAME> with your python package name
-ra
--durations 10
--cov-append --cov=<PACKAGE_NAME> --cov-report=term --cov-report=xml --junitxml=junit/test-results.xml
[coverage:report]
skip_empty = true
skip_covered = true
[flake8]
ignore =
# Lint rules to ignore
# W503 # line break before binary operator
# E203 # whitespace before ':'
# File-specific flake8 ignore rules
per-file-ignores =
# F403 'from X import *'
# F405 'X' may be undefined, or defined from star imports
# src/path/to/file/*.py:F403,F405
max-line-length = 180
exclude =
build, dist, docs, examples,
tests
.env*,.venv* # local virtual environments
.tox