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
This commit is contained in:
José Armando García Sancio
2015-01-20 18:50:20 +00:00
parent 1ef1867ede
commit 1f1345718d
6 changed files with 41 additions and 15 deletions

5
.gitignore vendored
View File

@@ -1,4 +1,7 @@
dcos.egg-info/ dcos.egg-info/
.ropeproject/
env/ env/
.ropeproject/
.tox/
*.pyc *.pyc

View File

View File

@@ -8,51 +8,62 @@ Setup
#. Make sure you meet requirements for installing packages_ #. Make sure you meet requirements for installing packages_
#. Install the "wheel" project:: #. Install the "wheel" project::
pip install wheel > pip install wheel
#. Install the tox project::
> pip install tox
#. Clone git repo for the dcos cli:: #. 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:: #. Change directory to the repo directory::
cd dcos-cli > cd dcos-cli
#. Create a virtualenv for the dcos cli project:: #. Create a virtualenv for the dcos cli project::
virtualenv --prompt='(dcos-cli) ' env > virtualenv --prompt='(dcos-cli) ' env
Configure Development Environment Configure Development Environment
--------------------------------- ---------------------------------
#. Activate the virtualenv:: #. Activate the virtualenv::
source env/bin/activate > source env/bin/activate
#. Install project in develop mode:: #. Install project in develop mode::
pip install -e . > pip install -e .
#. Export DCOS_PATH:: #. Export DCOS_PATH::
export DCOS_PATH=<path-to-project>/env > export DCOS_PATH=<path-to-project>/env
#. Export DCOS_CONFIG:: #. Export DCOS_CONFIG::
mkdir $DCOS_PATH/config > mkdir $DCOS_PATH/config
touch $DCOS_PATH/config/Dcos.toml > touch $DCOS_PATH/config/Dcos.toml
export DCOS_CONFIG=$DCOS_PATH/env/config/Dcos.toml > export DCOS_CONFIG=$DCOS_PATH/env/config/Dcos.toml
Running POC Running POC
----------- -----------
#. List command help:: #. List command help::
dcos --help > dcos --help
#. Run subcommand:: #. Run subcommand::
dcos config --help > dcos config --help
Running Tests:
--------------
#. Run tests using tox::
> tox
Notes Notes
----- -----

View File

View File

@@ -7,7 +7,7 @@ from os import path
here = path.abspath(path.dirname(__file__)) here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant 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() long_description = f.read()
setup( setup(
@@ -90,7 +90,8 @@ setup(
# Although 'package_data' is the preferred approach, in some case you may # Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages. # need to place data files outside of your packages.
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data' # In this case, 'data_file' will be installed into '<sys.prefix>/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 # To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow # "scripts" keyword. Entry points provide cross-platform support and allow

11
tox.ini Normal file
View File

@@ -0,0 +1,11 @@
[tox]
envlist = py27,py34
[testenv]
deps =
pytest
flake8
commands =
flake8 dcos tests
py.test tests