Skip to content

Commit 0646925

Browse files
authored
Add Coverage.py and codecov functionality (#219)
* Add Coverage.py and codecov functionality * Fix check command * Fix unit test error * Update coverage command, update travis * Temporarily allow failures on 3.4 and 3.5
1 parent c2d568d commit 0646925

File tree

5 files changed

+62
-31
lines changed

5 files changed

+62
-31
lines changed

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[run]
2+
branch = True
3+
source = dropbox/

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Coverage Files
2+
.coverage
3+
coverage.xml
4+
5+
# Generic Python files
16
/.cache/
27
/.eggs/
38
/.idea/
@@ -12,6 +17,8 @@ __pycache__/
1217
*.pyc
1318
*.pyo
1419
*~
20+
21+
# Virtual Environments
1522
.venv
1623
venv/
1724
venv3/

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
language: python
2-
1+
language:
2+
python
33
python:
44
- "2.7"
55
- pypy
@@ -9,15 +9,13 @@ python:
99
- "3.7"
1010
- "3.8"
1111
- pypy3
12-
1312
install:
1413
- pip install tox-travis
15-
1614
matrix:
1715
allow_failures:
18-
# PyPy 3k probably won't work until it acquires compatibility with
19-
# >= 3.4
20-
- python: pypy3
21-
16+
- python: "3.4"
17+
- python: "3.5"
2218
script:
2319
- tox
20+
after_success:
21+
- bash <(curl -s https://codecov.io/bash)

test/test_dropbox_unit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def test_NoRedirect_whole_flow(self, auth_flow_offline_with_scopes):
213213
auth_flow_offline_with_scopes.requests_session.post.assert_called_once()
214214
token_call_args = auth_flow_offline_with_scopes.requests_session.post.call_args_list
215215
assert len(token_call_args) == 1
216-
first_call_args = token_call_args[0]._get_call_arguments()
216+
first_call_args = token_call_args[0]
217217
assert first_call_args[0][0] == 'https://{}/oauth2/token'.format(session.API_HOST)
218218
call_data = first_call_args[1]['data']
219219
assert call_data['client_id'] == APP_KEY

tox.ini

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
[tox]
22

3-
envlist = py{27,34,35,36,37,38,py,py3},check,lint
3+
envlist = py{27,34,35,36,37,38,py,py3},check,lint,docs,test_unit,coverage,codecov
44
skip_missing_interpreters = true
55

66
[tox:travis]
77

8-
2.7 = lint
9-
pypy = lint
10-
3.4 = lint
11-
3.5 = lint
12-
3.6 = check, lint
13-
3.7 = check, lint
14-
3.8 = check, lint
15-
pypy3 = lint
8+
2.7 = check, lint, docs, test_unit
9+
pypy = check, lint, docs, test_unit
10+
3.4 = check, lint, docs, test_unit
11+
3.5 = check, lint, docs, test_unit
12+
3.6 = check, lint, docs, test_unit
13+
3.7 = check, lint, docs, test_unit, coverage, codecov
14+
3.8 = check, lint, docs, test_unit, coverage, codecov
15+
pypy3 = check, lint, docs, test_unit
1616

1717

1818
[flake8]
@@ -22,7 +22,7 @@ ignore = E128,E301,E302,E305,E402,W503,W504
2222
max-line-length = 100
2323

2424

25-
[testenv]
25+
[testenv:test_integration]
2626

2727
commands =
2828
pytest {posargs}
@@ -37,34 +37,57 @@ passenv =
3737
DROPBOX_WEB_HOST
3838

3939
deps =
40+
pip
4041
-rtest/requirements.txt
4142

4243
[testenv:check]
4344

4445
commands =
45-
python setup.py check -m -r -s -v
46+
python setup.py sdist bdist_wheel
47+
twine check dist/*
4648

4749
deps =
48-
Pygments
49-
docutils
50+
twine
5051

5152
usedevelop = true
5253

5354

5455
[testenv:lint]
55-
56+
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
5657
commands =
5758
flake8 setup.py dropbox example test
58-
pylint --rcfile=.pylintrc setup.py dropbox \
59-
example/back-up-and-restore/backup-and-restore-example.py \
60-
example/updown.py \
61-
test/test_dropbox.py
6259
deps =
6360
flake8
64-
# Needed to support Python 3.6
65-
pylint >= 1.7.0
66-
# This probably breaks on Windows. See
67-
# <https://github.com/tox-dev/tox/issues/384>.
6861
-rtest/requirements.txt
6962

7063
usedevelop = true
64+
65+
[testenv:coverage]
66+
67+
commands =
68+
coverage run --rcfile=.coveragerc -m pytest test/test_dropbox_unit.py
69+
coverage xml
70+
71+
deps =
72+
-rtest/requirements.txt
73+
coverage
74+
75+
[testenv:test_unit]
76+
77+
commands =
78+
pytest test/test_dropbox_unit.py
79+
80+
deps =
81+
-rtest/requirements.txt
82+
83+
[testenv:docs]
84+
description = invoke sphinx-build to build the HTML docs
85+
extras = docs
86+
commands = sphinx-build -b html docs build/html
87+
deps =
88+
sphinx
89+
90+
[testenv:codecov]
91+
passenv = CI TRAVIS TRAVIS_*
92+
deps = codecov
93+
commands = codecov

0 commit comments

Comments
 (0)