From 1f1345718d0d9a62df2ee9612e670c2951343aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Armando=20Garc=C3=ADa=20Sancio?= Date: Tue, 20 Jan 2015 18:50:20 +0000 Subject: [PATCH] DCOS-203 Add tox support for running tests We need this so that we can run the python teststests in a docker container from TeamCity. Tests: > pip install tox > tox --- .gitignore | 5 ++++- DESCRIPTION.rst | 0 README.rst | 35 +++++++++++++++++++++++------------ data/data_file | 0 setup.py | 5 +++-- tox.ini | 11 +++++++++++ 6 files changed, 41 insertions(+), 15 deletions(-) delete mode 100644 DESCRIPTION.rst delete mode 100644 data/data_file create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index c26e208..f1a964e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ dcos.egg-info/ -.ropeproject/ env/ + +.ropeproject/ +.tox/ + *.pyc diff --git a/DESCRIPTION.rst b/DESCRIPTION.rst deleted file mode 100644 index e69de29..0000000 diff --git a/README.rst b/README.rst index a5e867c..2bc6087 100644 --- a/README.rst +++ b/README.rst @@ -8,51 +8,62 @@ Setup #. Make sure you meet requirements for installing packages_ #. Install the "wheel" project:: - pip install wheel + > pip install wheel + +#. Install the tox project:: + + > pip install tox #. Clone git repo for the dcos cli:: - git clone git@github.com:mesosphere/dcos-cli.git + > git clone git@github.com:mesosphere/dcos-cli.git #. Change directory to the repo directory:: - cd dcos-cli + > cd dcos-cli #. Create a virtualenv for the dcos cli project:: - virtualenv --prompt='(dcos-cli) ' env + > virtualenv --prompt='(dcos-cli) ' env Configure Development Environment --------------------------------- #. Activate the virtualenv:: - source env/bin/activate + > source env/bin/activate #. Install project in develop mode:: - pip install -e . + > pip install -e . #. Export DCOS_PATH:: - export DCOS_PATH=/env + > export DCOS_PATH=/env #. Export DCOS_CONFIG:: - mkdir $DCOS_PATH/config - touch $DCOS_PATH/config/Dcos.toml - export DCOS_CONFIG=$DCOS_PATH/env/config/Dcos.toml + > mkdir $DCOS_PATH/config + > touch $DCOS_PATH/config/Dcos.toml + > export DCOS_CONFIG=$DCOS_PATH/env/config/Dcos.toml Running POC ----------- #. List command help:: - dcos --help + > dcos --help #. Run subcommand:: - dcos config --help + > dcos config --help + +Running Tests: +-------------- + +#. Run tests using tox:: + + > tox Notes ----- diff --git a/data/data_file b/data/data_file deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py index e70ad0d..5f5528a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file -with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f: +with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( @@ -90,7 +90,8 @@ setup( # Although 'package_data' is the preferred approach, in some case you may # need to place data files outside of your packages. # In this case, 'data_file' will be installed into '/my_data' - data_files=[('my_data', ['data/data_file'])], + # data_files=[('my_data', ['data/data_file'])], + data_files=[], # To provide executable scripts, use entry points in preference to the # "scripts" keyword. Entry points provide cross-platform support and allow diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..7574599 --- /dev/null +++ b/tox.ini @@ -0,0 +1,11 @@ +[tox] +envlist = py27,py34 + +[testenv] +deps = + pytest + flake8 + +commands = + flake8 dcos tests + py.test tests