Repository: mesos Updated Branches: refs/heads/master 7761066f6 -> 8e1596396
CLI: Added infrastructure for unit tests. This is the base to develop unit tests for the Mesos CLI. Review: https://reviews.apache.org/r/58146/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8e159639 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8e159639 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8e159639 Branch: refs/heads/master Commit: 8e1596396184014d3a9acbe95ed8612fc18806d7 Parents: 7761066 Author: Armand Grillet <[email protected]> Authored: Tue Apr 11 15:48:50 2017 -0700 Committer: Joseph Wu <[email protected]> Committed: Tue Apr 11 15:48:50 2017 -0700 ---------------------------------------------------------------------- src/cli_new/README.md | 27 +++++++++++++++++++++++++++ src/cli_new/bin/mesos-cli-tests | 6 ++++++ src/cli_new/pip-requirements.txt | 1 + src/cli_new/tests/main.py | 28 ++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/8e159639/src/cli_new/README.md ---------------------------------------------------------------------- diff --git a/src/cli_new/README.md b/src/cli_new/README.md index 0e60515..aa11813 100644 --- a/src/cli_new/README.md +++ b/src/cli_new/README.md @@ -34,3 +34,30 @@ when you are done. **NOTE:** The virtual environment will also setup bash autocomplete for all `mesos` commands. + + +## Running tests + +To run the unit tests developed for the Mesos CLI, use +`mesos-cli-tests`: + +``` +$ ./bootstrap + +... + +Setup complete! + +To begin working, simply activate your virtual environment, +run the CLI, and then deactivate the virtual environment +when you are done. + + $ source activate + $ mesos-cli-tests + +Running the Mesos CLI unit tests + +... + +OK +``` http://git-wip-us.apache.org/repos/asf/mesos/blob/8e159639/src/cli_new/bin/mesos-cli-tests ---------------------------------------------------------------------- diff --git a/src/cli_new/bin/mesos-cli-tests b/src/cli_new/bin/mesos-cli-tests new file mode 100755 index 0000000..07659e0 --- /dev/null +++ b/src/cli_new/bin/mesos-cli-tests @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +CURRDIR="$(cd "$(dirname "$0")" && pwd)" + +source ${CURRDIR}/../activate +python ${CURRDIR}/../tests/main.py "$@" http://git-wip-us.apache.org/repos/asf/mesos/blob/8e159639/src/cli_new/pip-requirements.txt ---------------------------------------------------------------------- diff --git a/src/cli_new/pip-requirements.txt b/src/cli_new/pip-requirements.txt index 9cc8d09..e73bbfd 100644 --- a/src/cli_new/pip-requirements.txt +++ b/src/cli_new/pip-requirements.txt @@ -9,4 +9,5 @@ Pygments==2.1.3 PyInstaller==3.1.1 pylint==1.6.4 six==1.10.0 +termcolor==1.1.0 wrapt==1.10.8 http://git-wip-us.apache.org/repos/asf/mesos/blob/8e159639/src/cli_new/tests/main.py ---------------------------------------------------------------------- diff --git a/src/cli_new/tests/main.py b/src/cli_new/tests/main.py new file mode 100644 index 0000000..dff5d48 --- /dev/null +++ b/src/cli_new/tests/main.py @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +This is the main executable of the mesos-cli unit tests. +""" + +import unittest + +from termcolor import colored + + +if __name__ == '__main__': + print colored("Running the Mesos CLI unit tests", "yellow") + unittest.main(verbosity=2, testRunner=unittest.TextTestRunner)
