From: Alfredo Deza Date: Wed, 25 Mar 2015 13:46:16 +0000 (-0400) Subject: ceph-disk: create initial structure for tox/unit tests X-Git-Tag: v9.0.0~96^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0f267c15eab872fcdbdb0aae5a36a5af4b47c90e;p=ceph.git ceph-disk: create initial structure for tox/unit tests Signed-off-by: Alfredo Deza --- diff --git a/src/test/python/ceph-disk/setup.py b/src/test/python/ceph-disk/setup.py new file mode 100644 index 0000000000000..91652baea20cc --- /dev/null +++ b/src/test/python/ceph-disk/setup.py @@ -0,0 +1,27 @@ +import os +from setuptools import setup, find_packages + +# link ceph-disk script here so we can "install" it +current_dir = os.path.abspath(os.path.dirname(__file__)) +src_dir = os.path.dirname(os.path.dirname(os.path.dirname(current_dir))) +script_path = os.path.join(src_dir, 'ceph-disk') + + +def link_target(source, destination): + if not os.path.exists(destination): + try: + os.symlink(source, destination) + except (IOError, OSError) as error: + print 'Ignoring linking of target: %s' % str(error) + +link_target(script_path, 'ceph_disk.py') + +setup( + name='ceph_disk', + version='0.1', + description='', + author='', + author_email='', + zip_safe=False, + packages=find_packages(), +) diff --git a/src/test/python/ceph-disk/tests/test_ceph_disk.py b/src/test/python/ceph-disk/tests/test_ceph_disk.py new file mode 100644 index 0000000000000..b6484875f935f --- /dev/null +++ b/src/test/python/ceph-disk/tests/test_ceph_disk.py @@ -0,0 +1,10 @@ +import ceph_disk + +# This file tests nothing (yet) except for being able to import ceph_disk +# correctly and thus ensuring somewhat that it will work under different Python +# versions. You must write unittests here so that code has adequate coverage. + +class TestCephDisk(object): + + def test_basic(self): + assert True diff --git a/src/test/python/ceph-disk/tox.ini b/src/test/python/ceph-disk/tox.ini new file mode 100644 index 0000000000000..8017044887b15 --- /dev/null +++ b/src/test/python/ceph-disk/tox.ini @@ -0,0 +1,16 @@ +[tox] +envlist = py26, py27, flake8 +skipsdist=True + +[testenv] +deps= + pytest + +commands= + python setup.py develop + py.test -v + +[testenv:flake8] +deps= + flake8 +commands=flake8 --select=F ceph_disk.py