From 4ec2305cd0951040c9d75e17855ad793ada8b343 Mon Sep 17 00:00:00 2001
From: Kun Huang <gareth@openstacker.org>
Date: Fri, 23 Oct 2015 23:06:30 +0800
Subject: [PATCH] add tox-related stuff

---
 .testr.conf            |  4 +++
 requirements.txt       |  3 ++
 test-requirements.txt  | 13 +++++++++
 tests/__init__.py      |  0
 tests/unit/__init__.py |  0
 tox.ini                | 63 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 83 insertions(+)
 create mode 100644 .testr.conf
 create mode 100644 requirements.txt
 create mode 100644 test-requirements.txt
 create mode 100644 tests/__init__.py
 create mode 100644 tests/unit/__init__.py
 create mode 100644 tox.ini

diff --git a/.testr.conf b/.testr.conf
new file mode 100644
index 0000000..1262335
--- /dev/null
+++ b/.testr.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ./tests/unit $LISTOPT $IDOPTION
+test_id_option=--load-list $IDFILE
+test_list_option=--list
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..b182fce
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,3 @@
+pbr
+oslo.db
+python-novaclient
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000..b5e0402
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,13 @@
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+hacking<0.10,>=0.9.2
+
+coverage>=3.6
+ddt>=0.7.0
+mock>=1.2
+testrepository>=0.0.18
+testtools>=1.4.0
+
+oslosphinx>=2.5.0 # Apache-2.0
+oslotest>=1.10.0 # Apache-2.0
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..571b16f
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,63 @@
+[tox]
+minversion = 1.6
+skipsdist = True
+envlist = py26,py27,py33,py34,pep8
+
+[testenv]
+setenv = VIRTUAL_ENV={envdir}
+         LANG=en_US.UTF-8
+         LANGUAGE=en_US:en
+         LC_ALL=C
+         PYTHONHASHSEED=0
+deps = -r{toxinidir}/requirements.txt
+       -r{toxinidir}/test-requirements.txt
+install_command = pip install -U {opts} {packages}
+usedevelop = True
+commands =
+  /usr/bin/find . -type f -name "*.pyc" -delete
+  python setup.py testr --slowest --testr-args='{posargs}'
+distribute = false
+basepython = python2.7
+
+[testenv:pep8]
+commands = flake8
+distribute = false
+
+[testenv:py26]
+basepython = python2.6
+
+
+[testenv:py34]
+basepython = python3.4
+
+
+[testenv:venv]
+commands = {posargs}
+
+[testenv:cli]
+sitepackages = True
+commands = {toxinidir}/tests/ci/rally-integrated.sh
+
+[testenv:cover]
+commands = {toxinidir}/tests/ci/cover.sh {posargs}
+
+
+[testenv:docs]
+changedir = doc/source
+commands = make html
+
+[testenv:genconfig]
+commands =
+    oslo-config-generator --config-file etc/rally/rally-config-generator.conf
+
+[tox:jenkins]
+downloadcache = ~/cache/pip
+
+[flake8]
+ignore = H703
+show-source = true
+exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,build,setup.py
+
+[hacking]
+import_exceptions = rally.common.i18n
+local-check-factory = tests.hacking.checks.factory