-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtox.ini
57 lines (50 loc) · 2.15 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
# Hey! We use conda to manage our data science environments because there are just too many complexities for pip or
# a virtualenv to handle reliably, especially with requirements like cuda and gdal. Unfortunately, tox does not play
# well with conda at the moment and it's not worthwhile to write a requirements.txt file with the test dependencies,
# only to find that we have obscure gdal errors to debug. Instead, we implement a simple hack to get the test
# environment working and encourage you to join us.
# First, install your dependencies using conda as described in the documentation, but also install the test dependencies
# from `environment_test.yaml`.
# Second, run tox using `tox` at the base of the repo. Tox is going to try to create a virtual environment for
# Python 3.7 and then it's going to error out because we haven't told it which dependencies were needed and it wasn't
# able to run tests.
# Third, navigate to `.tox/py37/bin`, where tox attempted to create the virtualenv. You'll want to delete the file
# `python3.7, which is the binary that tox used to try to run tests.
# Fourth, softlink your existing python 3.7 conda binary file to that same location. For me, that was using the
# command `ln -s ~/anaconda3/bin/python3.7 python3.7`.
# Fifth, run `tox` again from the base of the repo to confirm things are working.
[tox]
envlist = lint, py37
[testenv]
commands =
pytest --durations=10 --last-failed -n 2 --cov --no-cov-on-fail --cov-report term-missing:skip-covered
whitelist_externals =
pytest
pytest-cov
[testenv:lint]
description = Lint package
commands =
black bfgn --line-length 120 --target-version py37
isort -rc .
whitelist_externals =
black
isort
[isort]
line_length = 120
multi_line_output = 2
[pytest]
filterwarnings =
ignore::DeprecationWarning:google
ignore::DeprecationWarning:keras
ignore::DeprecationWarning:numpy
ignore::DeprecationWarning:osgeo
ignore::DeprecationWarning:tensorflow
ignore::PendingDeprecationWarning:tensorflow
python_files = test_*.py
python_functions = test_*
testpaths = bfgn/tests
# Parameters for pytest-cov
[coverage:run]
branch = True
omit = bfgn/tests/*
source = bfgn