From 7b36b042dd07adfb5208c0700cc0deb474ef97dd Mon Sep 17 00:00:00 2001
From: Surya Prakash Singh <surya.singh@nectechnologies.in>
Date: Thu, 12 Jan 2017 18:15:04 +0530
Subject: [PATCH] Cover environment for kolla-ansible

Enabled the cover environment for kolla-ansible in tox

Change-Id: Ic9f0dbc14ff9f4ef3d82bd06eb58fc145cb121d9
Closes-bug: #1655948
---
 .gitignore            | 2 ++
 test-requirements.txt | 1 +
 tox.ini               | 8 ++++++++
 3 files changed, 11 insertions(+)

diff --git a/.gitignore b/.gitignore
index 5012e9901..37d260773 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,8 @@ AUTHORS
 ChangeLog
 doc/build
 etc/kolla/kolla-build.conf
+.coverage
+cover/
 
 # Files generated by Vagrant
 dev/vagrant/Vagrantfile.custom
diff --git a/test-requirements.txt b/test-requirements.txt
index 4fb167d9d..296f99d9f 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,6 +4,7 @@
 bandit>=1.1.0 # Apache-2.0
 bashate>=0.2 # Apache-2.0
 beautifulsoup4 # MIT
+coverage>=4.0 # Apache-2.0
 doc8 # Apache-2.0
 extras # MIT
 graphviz!=0.5.0,>=0.4.0 # MIT License
diff --git a/tox.ini b/tox.ini
index 89fc377c4..2241814ba 100644
--- a/tox.ini
+++ b/tox.ini
@@ -21,6 +21,14 @@ commands =
 [testenv:debug]
 commands = oslo_debug_helper {posargs}
 
+[testenv:cover]
+setenv = VIRTUAL_ENV={envdir}
+         NOSE_WITH_COVERAGE=1
+         NOSE_COVER_BRANCHES=1
+         NOSE_COVER_HTML=1
+         NOSE_COVER_HTML_DIR={toxinidir}/cover
+commands = python setup.py testr --coverage --testr-args='{posargs}'
+
 [testenv:pep8]
 commands =
   {toxinidir}/tools/run-bashate.sh
-- 
GitLab