diff options
author | Prashanth Pai <ppai@redhat.com> | 2016-03-10 11:38:07 +0530 |
---|---|---|
committer | Prashanth Pai <ppai@redhat.com> | 2016-03-10 12:44:09 +0530 |
commit | 1815ad27684435a0612c987b5d6d8893417593f8 (patch) | |
tree | 70fe89a6221afa4213b6c19e027a531ea9656dd2 | |
parent | 6df97fd49fa9be6394bd066c6c64fd7c06959a77 (diff) |
Fix and simplify tox.ini
* Remove deprecated tox options
* Simplify tox.ini
* Update .gitignore
* Update test-requirements.txt
* Fix pep8 issues
All tests now run on centos7 without any modifications.
Code coverage output is now displayed properly for both unit test
and functional test runs.
Change-Id: I877cc0ad2c560579c12d528af3ac9bf5eea28378
Signed-off-by: Prashanth Pai <ppai@redhat.com>
-rwxr-xr-x | .functests (renamed from functional_tests.sh) | 32 | ||||
-rw-r--r-- | .gitignore | 14 | ||||
-rw-r--r-- | gluster/__init__.py | 4 | ||||
-rwxr-xr-x | gluster/api.py | 10 | ||||
-rw-r--r-- | test-requirements.txt | 4 | ||||
-rw-r--r-- | tox.ini | 30 |
6 files changed, 29 insertions, 65 deletions
diff --git a/functional_tests.sh b/.functests index 32fcbe6..44739c0 100755 --- a/functional_tests.sh +++ b/.functests @@ -18,29 +18,11 @@ # This program expects to be run by tox in a virtual python environment # so that it does not pollute the host development system -cleanup() -{ - if [ -d "/export/brick/b1/" ]; then - sudo rm -rf /export/brick/b1/* > /dev/null 2>&1 - fi -} +SRC_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))") +set -e +cd ${SRC_DIR} -fail() -{ - cleanup - echo "$1" - exit 1 -} - -### MAIN ### - -mkdir functional_tests > /dev/null 2>&1 -nosetests -v --exe \ - --with-xunit \ - --xunit-file functional_tests/libgfapi-python.xml \ - --with-html-output \ - --html-out-file functional_tests/libgfapi-python-result.html \ - test/functional || fail "Functional tests failed" - -cleanup -exit 0 +nosetests -v --exe test/functional +rvalue=$? +cd - +exit $rvalue @@ -1,9 +1,9 @@ +*.py[co] .tox -gfapi.egg-info -test/unit/.coverage -test/unit/nosetests.xml -test/unit/coverage.xml -test/unit/cover -functional_tests +*.egg +*.egg-info +.coverage +cover +pycscope.* build -*.pyc +dist diff --git a/gluster/__init__.py b/gluster/__init__.py index 4562ec8..351a4f3 100644 --- a/gluster/__init__.py +++ b/gluster/__init__.py @@ -41,9 +41,7 @@ class PkgInfo(object): return '%s-dev' % (self.canonical_version,) -### -### Change the Package version here -### +# Change the Package version here _pkginfo = PkgInfo('0.0.1', '0', 'python-libgfapi', False) __version__ = _pkginfo.pretty_version __canonical_version__ = _pkginfo.canonical_version diff --git a/gluster/api.py b/gluster/api.py index c0bad67..7163076 100755 --- a/gluster/api.py +++ b/gluster/api.py @@ -200,7 +200,7 @@ class Dirent (ctypes.Structure): # glfs_posix_lock; # glfs_dup; # -# } +# } # # GFAPI_3.4.2 { # glfs_setfsuid; @@ -478,10 +478,8 @@ glfs_getcwd = gfapi_prototype('glfs_getcwd', ctypes.c_char_p, # TODO: # discard and fallocate fails with "AttributeError: /lib64/libgfapi.so.0: undefined symbol: glfs_discard", # noqa # for time being, using it from api.* # noqa # glfs_discard = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_size_t)(('glfs_discard', client)) # noqa -#_glfs_fallocate = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_ulong, ctypes.c_size_t) # noqa +# _glfs_fallocate = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_ulong, ctypes.c_size_t) # noqa # (('glfs_fallocate', client)) # noqa - - -#glfs_discard = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_size_t)(('glfs_discard', client)) # noqa -#glfs_fallocate = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_ulong, ctypes.c_size_t)(('glfs_fallocate', client)) # noqa +# glfs_discard = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_size_t)(('glfs_discard', client)) # noqa +# glfs_fallocate = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_ulong, ctypes.c_size_t)(('glfs_fallocate', client)) # noqa diff --git a/test-requirements.txt b/test-requirements.txt index 4ddce0f..c6662ef 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,9 +1,7 @@ # Hacking already pins down pep8, pyflakes and flake8 -hacking>=0.8.0,<0.9 +hacking>=0.10.0,<0.11 coverage nose nosexcover -openstack.nose_plugin nosehtmloutput -sphinx>=1.1.2 mock>=1.0 @@ -1,40 +1,28 @@ [tox] envlist = py26,py27,pep8 +minversion = 1.6 [testenv] -whitelist_externals=bash passenv = LD_LIBRARY_PATH setenv = VIRTUAL_ENV={envdir} - NOSE_WITH_OPENSTACK=1 - NOSE_OPENSTACK_COLOR=1 - NOSE_OPENSTACK_RED=0.05 - NOSE_OPENSTACK_YELLOW=0.025 - NOSE_OPENSTACK_SHOW_ELAPSED=1 - NOSE_OPENSTACK_STDOUT=1 + NOSE_WITH_COVERAGE=1 + NOSE_COVER_BRANCHES=1 + NOSE_COVER_ERASE=1 + NOSE_COVER_PACKAGE=gluster deps = - --download-cache={homedir}/.pipcache -r{toxinidir}/test-requirements.txt -changedir = {toxinidir}/test/unit -commands = nosetests -v --exe --with-xunit --with-coverage --cover-package gluster --cover-erase --cover-xml --cover-html --cover-branches --with-html-output {posargs} - -[tox:jenkins] -downloadcache = ~/cache/pip +commands = nosetests -v {posargs:test/unit} [testenv:functest] -changedir = {toxinidir} -commands = bash functional_tests.sh +commands = ./.functests {posargs} [testenv:pep8] -deps = - --download-cache={homedir}/.pipcache - -r{toxinidir}/test-requirements.txt -changedir = {toxinidir} commands = - flake8 setup.py - flake8 gluster test + flake8 {posargs:gluster test setup.py} [testenv:cover] setenv = NOSE_WITH_COVERAGE=1 + NOSE_COVER_BRANCHES=1 [testenv:venv] commands = {posargs} |