]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard_v2: added tox conf file to run unit tests and linting
authorRicardo Dias <rdias@suse.com>
Tue, 27 Feb 2018 13:21:44 +0000 (13:21 +0000)
committerRicardo Dias <rdias@suse.com>
Mon, 5 Mar 2018 13:06:58 +0000 (13:06 +0000)
Signed-off-by: Ricardo Dias <rdias@suse.com>
src/pybind/mgr/dashboard_v2/.gitignore [new file with mode: 0644]
src/pybind/mgr/dashboard_v2/README.rst
src/pybind/mgr/dashboard_v2/requirements.txt [new file with mode: 0644]
src/pybind/mgr/dashboard_v2/tox.ini [new file with mode: 0644]

diff --git a/src/pybind/mgr/dashboard_v2/.gitignore b/src/pybind/mgr/dashboard_v2/.gitignore
new file mode 100644 (file)
index 0000000..2fa7803
--- /dev/null
@@ -0,0 +1,12 @@
+.coverage
+htmlcov
+.tox
+coverage.xml
+junit.xml
+
+# IDE
+.vscode
+.idea
+
+# virtualenv
+venv
index 7f7820f5f7d1362e78cee64bbbc81ee1e5de6ce8..3516ca4b3e5599c0e0ec7ac6ff63c77d4f8b7bcb 100644 (file)
@@ -18,16 +18,25 @@ The porting of the existing openATTIC functionality will be done in stages. The
 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
 
diff --git a/src/pybind/mgr/dashboard_v2/requirements.txt b/src/pybind/mgr/dashboard_v2/requirements.txt
new file mode 100644 (file)
index 0000000..0f72fc2
--- /dev/null
@@ -0,0 +1,29 @@
+astroid==1.6.1
+attrs==17.4.0
+backports.functools-lru-cache==1.4
+cheroot==6.0.0
+CherryPy==13.1.0
+configparser==3.5.0
+coverage==4.4.2
+enum34==1.1.6
+funcsigs==1.0.2
+isort==4.2.15
+lazy-object-proxy==1.3.1
+mccabe==0.6.1
+mock==2.0.0
+more-itertools==4.1.0
+pbr==3.1.1
+pluggy==0.6.0
+portend==2.2
+py==1.5.2
+pylint==1.8.2
+pytest==3.3.2
+pytest-cov==2.5.1
+python-bcrypt==0.3.2
+pytz==2017.3
+singledispatch==3.4.0.3
+six==1.11.0
+tempora==1.10
+tox==2.9.1
+virtualenv==15.1.0
+wrapt==1.10.11
diff --git a/src/pybind/mgr/dashboard_v2/tox.ini b/src/pybind/mgr/dashboard_v2/tox.ini
new file mode 100644 (file)
index 0000000..6f6e458
--- /dev/null
@@ -0,0 +1,28 @@
+[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 .
+