$ pip install coverage
To run the tests, run ``run-tox.sh`` in the dashboard directory (where
-``tox.ini`` is located).
+``tox.ini`` is located)::
-We also collect coverage information from the backend code. You can check the
+ ## Run Python 2+3 tests+lint commands:
+ $ ./run-tox.sh
+
+ ## Run Python 3 tests+lint commands:
+ $ WITH_PYTHON2=OFF ./run-tox.sh
+
+ ## Run Python 3 arbitrary command (e.g. 1 single test):
+ $ WITH_PYTHON2=OFF ./run-tox.sh pytest tests/test_rgw_client.py::RgwClientTest::test_ssl_verify
+
+You can also run tox instead of ``run-tox.sh``::
+
+ ## Run Python 3 tests command:
+ $ CEPH_BUILD_DIR=.tox tox -e py3-cov
+
+ ## Run Python 3 arbitrary command (e.g. 1 single test):
+ $ CEPH_BUILD_DIR=.tox tox -e py3-run pytest tests/test_rgw_client.py::RgwClientTest::test_ssl_verify
+
+We also collect coverage information from the backend code when you run tests. You can check the
coverage information provided by the tox output, or by running the following
command after tox has finished successfully::
This command will create a directory ``htmlcov`` with an HTML representation of
the code coverage of the backend.
-You can also run a single step of the tox script (aka tox environment), for
-instance if you only want to run the linting tools, do::
-
- $ tox -e lint
-
API tests based on Teuthology
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
source ${MGR_DASHBOARD_VIRTUALENV}/bin/activate
if [ "$WITH_PYTHON2" = "ON" ]; then
- ENV_LIST+="py27-cov,py27-lint,"
+ if [[ -n "$@" ]]; then
+ ENV_LIST+="py27-run,"
+ else
+ ENV_LIST+="py27-cov,py27-lint,"
+ fi
fi
if [ "$WITH_PYTHON3" = "ON" ]; then
- ENV_LIST+="py3-cov,py3-lint"
+ if [[ -n "$@" ]]; then
+ ENV_LIST+="py3-run"
+ else
+ ENV_LIST+="py3-cov,py3-lint"
+ fi
fi
-tox -c ${TOX_PATH} -e $ENV_LIST
+tox -c ${TOX_PATH} -e "$ENV_LIST" "$@"
[tox]
-envlist = {py27,py3}-cov,{py27,py3}-lint
+envlist = py27-{cov,lint,run},py3-{cov,lint,run}
skipsdist = true
toxworkdir = {env:CEPH_BUILD_DIR}/dashboard
minversion = 2.8.1
cov: coverage xml
lint: pylint --rcfile=.pylintrc --jobs=5 . module.py tools.py controllers tests services exceptions.py
lint: pycodestyle --max-line-length=100 --exclude=.tox,venv,frontend,.vscode --ignore=E402,E121,E123,E126,E226,E24,E704,W503,E741 .
+ run: {posargs}