work is done by the openATTIC team and is currently tracked in the `openATTIC
JIRA <https://tracker.openattic.org/browse/OP-3039>`_.
-Unit Testing
-____________
+Unit Testing and Linting
+________________________
-To run the unit tests that reside in :emphasis:`tests/*` do::
+We included a tox configuration file that will run the unit tests under
+python2 and python3, as well as, linting tools to guarantee the uniformity of
+code.
- UNITTEST=true py.test --cov=. tests/
+To run tox, run the following command in the root directory (where ``tox.ini``
+is located) do::
+ tox
-These tests depend on the following python libraries:
- * pytest
- * pytest-cov
- * mock
+If you just want to run a single tox environement, for instance only run the
+linting tools, do::
+
+ tox -e lint
+
+Also don't forget to install tox before running it. To install tox in your
+system do::
+
+ pip install tox
--- /dev/null
+[tox]
+envlist = py27,py3,lint
+skipsdist = true
+
+[testenv:py27]
+deps=-r{toxinidir}/requirements.txt
+setenv=
+ UNITTEST=true
+ WEBTEST_INTERACTIVE=false
+commands=
+ {envbindir}/py.test --cov=. --cov-report=term tests/
+
+[testenv:py3]
+deps=-r{toxinidir}/requirements.txt
+setenv=
+ UNITTEST=true
+ WEBTEST_INTERACTIVE=false
+commands=
+ {envbindir}/py.test --cov=. --cov-report=term --cov-report=xml --junitxml=junit.xml tests/
+
+[testenv:lint]
+deps=
+ pylint
+ pycodestyle
+commands=
+ pylint --rcfile=.pylintrc --jobs=5 .
+ pycodestyle --max-line-length=100 --exclude=ceph_module_mock.py,python2.7,tests,.tox,venv .
+