From 8931d361916d22e5a0c4a7345a9a6bbd80ef80ee Mon Sep 17 00:00:00 2001 From: Didier Raboud Date: Fri, 4 May 2012 13:41:25 +0200 Subject: [PATCH] PyUT: Add initial unittest framework, limit possible python versions to >= 2.7. Limiting the supported python versions to >= 2.6 permits to avoid unneccessary code to permit the use of unittest in all python 2 and 3 versions such as: import sys if sys.version_info[0] >= 3: import unittest else: import unittest2 as unittest python2.7 is the default version in Debian unstable since Sep 2011. --- debian/control | 3 ++- debian/rules | 7 +++++++ test/test_lsb_release.py | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/test_lsb_release.py diff --git a/debian/control b/debian/control index fde40a4..7bcca79 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,8 @@ Uploaders: Didier Raboud , Jeff Licquia Build-Depends: debhelper (>> 7.0.50~), po-debconf (>= 0.5.0), dpkg-dev (>= 1.10), - python-all-dev (>= 2.6.6-6~) + python-all-dev (>= 2.6.6-6~), +X-Python-Version: >= 2.7 Standards-Version: 3.9.3 Homepage: http://www.linuxfoundation.org/collaborate/workgroups/lsb Vcs-Git: git://anonscm.debian.org/collab-maint/lsb.git diff --git a/debian/rules b/debian/rules index a465fc4..07c6067 100755 --- a/debian/rules +++ b/debian/rules @@ -2,6 +2,8 @@ derives_from_ubuntu := $(shell (dpkg-vendor --derives-from Ubuntu && echo "yes") || echo "no") +PY2VERSIONS=$(shell pyversions -vr) + %: dh --with python2 $@ @@ -44,6 +46,11 @@ override_dh_clean: dh_clean rm -f *.py[co] +override_dh_auto_test: $(PY2VERSIONS:%=test-python%) + +test-python%: + PYTHONPATH=. python$* test/test_lsb_release.py -vv + override_dh_python2: dh_python2 dh_python2 /usr/lib/lsb diff --git a/test/test_lsb_release.py b/test/test_lsb_release.py new file mode 100644 index 0000000..bc927f8 --- /dev/null +++ b/test/test_lsb_release.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +import unittest + +import lsb_release as lr + +import random +import string + +class TestLSBRelease(unittest.TestCase): + + def test_void(self): + self.assertTrue('Void test') + +if __name__ == '__main__': + unittest.main() -- 2.30.2