Add branch coverage reporting
Except where the python-nose package version does not support the "--cover-branches" option. Change-Id: I9ea6452d9834b3ac414e14e628002f593dd4b8c8 Signed-off-by: Peter Portante <peter.portante@redhat.com>
This commit is contained in:
		@@ -1,7 +1,13 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					python -c 'from distutils.version import LooseVersion as Ver; import nose, sys; sys.exit(0 if Ver(nose.__version__) >= Ver("1.2.0") else 1)'
 | 
				
			||||||
 | 
					if [ $? != 0 ]; then
 | 
				
			||||||
 | 
					    cover_branches=""
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    cover_branches="--cover-branches"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
cd $(dirname $0)/test/unit
 | 
					cd $(dirname $0)/test/unit
 | 
				
			||||||
nosetests --exe --with-coverage --cover-package swift. --cover-erase $@
 | 
					nosetests --exe --with-coverage --cover-package swift. --cover-erase $cover_branches $@
 | 
				
			||||||
rvalue=$?
 | 
					rvalue=$?
 | 
				
			||||||
rm -f .coverage
 | 
					rm -f .coverage
 | 
				
			||||||
cd -
 | 
					cd -
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tox.ini
									
									
									
									
									
								
							@@ -9,6 +9,8 @@ setenv = VIRTUAL_ENV={envdir}
 | 
				
			|||||||
         NOSE_OPENSTACK_YELLOW=0.025
 | 
					         NOSE_OPENSTACK_YELLOW=0.025
 | 
				
			||||||
         NOSE_OPENSTACK_SHOW_ELAPSED=1
 | 
					         NOSE_OPENSTACK_SHOW_ELAPSED=1
 | 
				
			||||||
         NOSE_OPENSTACK_STDOUT=1
 | 
					         NOSE_OPENSTACK_STDOUT=1
 | 
				
			||||||
 | 
					         NOSE_WITH_COVERAGE=1
 | 
				
			||||||
 | 
					         NOSE_COVER_BRANCHES=1
 | 
				
			||||||
deps =
 | 
					deps =
 | 
				
			||||||
  -r{toxinidir}/requirements.txt
 | 
					  -r{toxinidir}/requirements.txt
 | 
				
			||||||
  -r{toxinidir}/test-requirements.txt
 | 
					  -r{toxinidir}/test-requirements.txt
 | 
				
			||||||
@@ -22,9 +24,6 @@ commands =
 | 
				
			|||||||
  flake8
 | 
					  flake8
 | 
				
			||||||
  flake8 --filename=swift* bin
 | 
					  flake8 --filename=swift* bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[testenv:cover]
 | 
					 | 
				
			||||||
setenv = NOSE_WITH_COVERAGE=1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[testenv:venv]
 | 
					[testenv:venv]
 | 
				
			||||||
commands = {posargs}
 | 
					commands = {posargs}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user