MT#9683 improve unit-tests execution

- add Makefile with test rule
- add use of virtualenv to run tests
- add requirements.txt
- use junit report
- skip it on debian/rules

Change-Id: I393431317de7dd1b445ae568a14291a370bc22b3
changes/56/1356/3
Victor Seva 11 years ago committed by Víctor Seva
parent 2383cafe85
commit 07545f7964

@ -0,0 +1,27 @@
# do nothing as default
all:
.ONESHELL:
SHELL = /bin/bash
venv: requirements.txt
virtualenv --python=python2.7 venv
source ./venv/bin/activate && \
pip install -r ./requirements.txt >install.log
test_check: venv tests/test_check.py
mkdir -p reports
source ./venv/bin/activate && \
./tests/test_check.py > reports/$(@).xml
# run this in parallel!! -j is your friend
test: test_check
# get rid of test files
clean:
rm -rf install.log
# also get rid of pip environment
dist-clean: clean
rm -rf venv
.PHONY: all

6
debian/rules vendored

@ -10,6 +10,10 @@
#export DH_VERBOSE=1
%:
dh $@
dh $@
override_dh_usrlocal:
echo "skipping dh_usrlocal"
override_dh_auto_test:
echo "skipping dh_auto_test"

@ -0,0 +1,2 @@
unittest-xml-reporting
pyaml

@ -20,12 +20,13 @@
#
import os
import sys
import unittest
import xmlrunner
import yaml
lib_path = os.path.abspath('bin')
sys.path.append(lib_path)
from check import check_sip, check_sip_out
from check import XAvp, Test, check_flow, check_flow_vars
import unittest
import yaml
class TestXAvp(unittest.TestCase):
@ -160,4 +161,8 @@ class TestCheckSipOut(unittest.TestCase):
self.assertFalse(self.ctest.isError())
if __name__ == '__main__':
unittest.main()
unittest.main(
testRunner=xmlrunner.XMLTestRunner(output=sys.stdout),
# these make sure that some options that are not applicable
# remain hidden from the help menu.
failfast=False, buffer=False, catchbreak=False)

Loading…
Cancel
Save