~~~~~~~~~~~~~~~~~~~~~~~~
We included a ``tox`` configuration file that will run the unit tests under
-Python 2 or 3, as well as linting tools to guarantee the uniformity of code.
+Python 3, as well as linting tools to guarantee the uniformity of code.
You need to install ``tox`` and ``coverage`` before running it. To install the
packages in your system, either install it via your operating system's package
To run the tests, run ``src/script/run_tox.sh`` in the dashboard directory (where
``tox.ini`` is located)::
- ## Run Python 2+3 tests+lint commands:
- $ ../../../script/run_tox.sh --tox-env py27,py3,lint,check
-
## Run Python 3 tests+lint commands:
$ ../../../script/run_tox.sh --tox-env py3,lint,check
$ tox -e py3,lint,check
## To run it as Jenkins would:
- $ ../../../script/run_tox.sh --tox-env py27,py3,lint,check
$ ../../../script/run_tox.sh --tox-env py3,lint,check
Manager core unit tests
example:
-following command will run tox with envlist of "py27,py3" using the "tox.ini" in current directory.
+following command will run tox with envlist of "py3,mypy" using the "tox.ini" in current directory.
- $prog_name --tox-envs py27,py3
+ $prog_name --tox-envs py3,mypy
-following command will run tox with envlist of "py27" using "/ceph/src/python-common/tox.ini"
+following command will run tox with envlist of "py3" using "/ceph/src/python-common/tox.ini"
- $prog_name --tox-envs py27 --tox-path /ceph/src/python-common
+ $prog_name --tox-envs py3 --tox-path /ceph/src/python-common
EOF
}
echo "$PWD already exists, but it's not a virtualenv. test_name empty?"
exit 1
fi
- # try to use the prefered python for creating the virtual env for
- # bootstrapping tox.
- case $tox_envs in
- py3*)
- virtualenv_python=python3;;
- py2*)
- virtualenv_python=python2;;
- *)
- virtualenv_python=python3;;
- esac
- $source_dir/src/tools/setup-virtualenv.sh --python=${virtualenv_python} ${venv_path}
+ $source_dir/src/tools/setup-virtualenv.sh ${venv_path}
fi
source ${venv_path}/bin/activate
pip install tox