add tox framework for pep8 and unittest 69/32469/3
authorSerenaFeng <feng.xiaowei@zte.com.cn>
Thu, 30 Mar 2017 11:26:06 +0000 (19:26 +0800)
committerSerenaFeng <feng.xiaowei@zte.com.cn>
Thu, 30 Mar 2017 11:27:50 +0000 (19:27 +0800)
Change-Id: If783d387c29dad7fa472578ead2bcd5a6d42ee70
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
.coveragerc [new file with mode: 0644]
.gitignore
requirements.txt [new file with mode: 0644]
setup.py [new file with mode: 0644]
test-requirements.txt [new file with mode: 0644]
tests/__init__.py [new file with mode: 0644]
tests/unit/__init__.py [new file with mode: 0644]
tests/unit/test_placeholder.py [new file with mode: 0644]
tox.ini [new file with mode: 0644]

diff --git a/.coveragerc b/.coveragerc
new file mode 100644 (file)
index 0000000..d58e276
--- /dev/null
@@ -0,0 +1,28 @@
+# .coveragerc to control coverage.py
+
+[run]
+branch = True
+source =
+    deploy
+    tests
+
+[report]
+# Regexes for lines to exclude from consideration
+exclude_lines =
+    # Have to re-enable the standard pragma
+    pragma: no cover
+
+    # Don't complain about missing debug-only code:
+    def __repr__
+    if self\.debug
+
+    # Don't complain if tests don't hit defensive assertion code:
+    raise AssertionError
+    raise NotImplementedError
+
+    # Don't complain if non-runnable code isn't run:
+    if 0:
+    if __name__ == .__main__.:
+
+ignore_errors = True
+
index 078f1c9..b636538 100644 (file)
@@ -42,6 +42,7 @@ pip-delete-this-directory.txt
 .tox/
 .coverage
 .cache
+coverage.xml
 
 # Log files:
 *.log
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/setup.py b/setup.py
new file mode 100644 (file)
index 0000000..d556de7
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+from setuptools import setup
+
+setup(
+    name="daisy",
+    version="master",
+    url="https://www.opnfv.org",
+)
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644 (file)
index 0000000..0483907
--- /dev/null
@@ -0,0 +1,5 @@
+pytest
+pytest-cov
+pytest-faker
+pytest-mock
+
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/unit/test_placeholder.py b/tests/unit/test_placeholder.py
new file mode 100644 (file)
index 0000000..457e464
--- /dev/null
@@ -0,0 +1,2 @@
+def test_holder():
+    assert True
diff --git a/tox.ini b/tox.ini
new file mode 100644 (file)
index 0000000..28fbf8f
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,42 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py27,pep8
+skipsdist = True
+
+[testenv]
+usedevelop = True
+install_command = pip install -U {opts} {packages}
+deps =
+  -rrequirements.txt
+  -rtest-requirements.txt
+commands=
+  py.test \
+    --basetemp={envtmpdir} \
+    --cov \
+    --cov-report term-missing \
+    --cov-report xml \
+    {posargs}
+setenv=
+  HOME = {envtmpdir}
+  PYTHONPATH = {toxinidir}
+
+[testenv:pep8]
+deps = flake8
+commands = flake8 {toxinidir}
+
+[flake8]
+# H803 skipped on purpose per list discussion.
+# E123, E125 skipped as they are invalid PEP-8.
+
+show-source = True
+ignore = E123,E125,H803,E501
+builtins = _
+exclude = build,dist,doc,legacy,.eggs,.git,.tox,.venv
+
+[pytest]
+testpaths = tests
+python_functions = test_*