From 65d9b15e0c1c803c5e8ab8bb4fabe0a601a5f010 Mon Sep 17 00:00:00 2001 From: narzeja Date: Sat, 15 Oct 2016 11:56:34 +0200 Subject: [PATCH] add tox for test and coverage automation. Add development requirements.txt --- .coveragerc | 7 +++++++ .gitignore | 9 ++++++++- requirements-dev.txt | 7 +++++++ tox.ini | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .coveragerc create mode 100644 requirements-dev.txt create mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..f4c5b83f --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +branch = True +source = sanic, tests +omit = site-packages + +[html] +directory = coverage \ No newline at end of file diff --git a/.gitignore b/.gitignore index df21bc61..2cd14ae0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ +*~ +*.egg-info +*.egg +.coverage +.coverage.* +coverage +.tox settings.py *.pyc .idea/* -.cache/* \ No newline at end of file +.cache/* diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..d11f8e8d --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,7 @@ +httptools +ujson +uvloop +aiohttp +pytest +coverage +tox diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..258395ed --- /dev/null +++ b/tox.ini @@ -0,0 +1,34 @@ +[tox] + +envlist = py35, report + +[testenv] + +deps = + aiohttp + pytest + # pytest-cov + coverage + +commands = + coverage run -m pytest tests {posargs} + mv .coverage .coverage.{envname} + +basepython: + py35: python3.5 + +whitelist_externals = + coverage + mv + echo + +[testenv:report] + +commands = + coverage combine + coverage report + coverage html + echo "Open file://{toxinidir}/coverage/index.html" + +basepython = + python3.5 \ No newline at end of file